logic: Fixed error view related issues
* polished color schemes for error view * fixed error id column not hidden * fixed error count shown correctly in each view * moved storage stats logging to application * fixed indexed flag of errors broken for indexed headers in cdb project * fixed scrolling to active error when errors where not visible before * reverted tictactoe files to no errors
This commit is contained in:
@@ -394,24 +394,24 @@
|
||||
</edge>
|
||||
</graph>
|
||||
<error>
|
||||
<background>#272728</background>
|
||||
<table>white</table>
|
||||
<background>#494949</background>
|
||||
<table>#C4C4C4</table>
|
||||
<text>
|
||||
<normal>white</normal>
|
||||
<normal>#C4C4C4</normal>
|
||||
<active>black</active>
|
||||
</text>
|
||||
<table_line_1>
|
||||
<normal>darkgrey</normal>
|
||||
<active>white</active>
|
||||
<normal>#494949</normal>
|
||||
<active>#7B7B7B</active>
|
||||
</table_line_1>
|
||||
<table_line_2>
|
||||
<normal>#343434</normal>
|
||||
<active>white</active>
|
||||
<normal>#383838</normal>
|
||||
<active>#7B7B7B</active>
|
||||
</table_line_2>
|
||||
</error>
|
||||
<tab>
|
||||
<background>#272728</background>
|
||||
<active>white</active>
|
||||
<background>#494949</background>
|
||||
<active>#C4C4C4</active>
|
||||
<hover>#878787</hover>
|
||||
<text>#878787</text>
|
||||
</tab>
|
||||
|
||||
@@ -397,11 +397,11 @@
|
||||
</text>
|
||||
<table_line_1>
|
||||
<normal>darkgrey</normal>
|
||||
<active>white</active>
|
||||
<active>#969696</active>
|
||||
</table_line_1>
|
||||
<table_line_2>
|
||||
<normal>#343434</normal>
|
||||
<active>white</active>
|
||||
<active>#969696</active>
|
||||
</table_line_2>
|
||||
</error>
|
||||
<tab>
|
||||
|
||||
@@ -8,7 +8,7 @@ Field::Token Field::Opponent( Token token ) {
|
||||
} else if (token == PlayerB){
|
||||
return PlayerA;
|
||||
} else {
|
||||
return Non;
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ bool Field::InRange( const Move& move ) const {
|
||||
}
|
||||
|
||||
bool Field::IsEmpty( const Move& move ) const {
|
||||
return grid[move.row][move.col] == None;
|
||||
return grid_[move.row][move.col] == None;
|
||||
}
|
||||
|
||||
bool Field::IsFull() const {
|
||||
|
||||
@@ -11,7 +11,7 @@ HumanPlayer::~HumanPlayer() {
|
||||
|
||||
Field::Move HumanPlayer::Turn( const Field& field ) const {
|
||||
Field::Move move;
|
||||
io::stringOu(name_);
|
||||
io::stringOut(name_);
|
||||
io::stringOut("\n");
|
||||
|
||||
do {
|
||||
@@ -33,13 +33,13 @@ Field::Move HumanPlayer::Input() const {
|
||||
io::stringOut("Insert column: ");
|
||||
move.col = io::numberIn();
|
||||
|
||||
io::tringOut("\n");
|
||||
io::stringOut("\n");
|
||||
return move;
|
||||
}
|
||||
|
||||
bool HumanPlayer::Check( const Field& field, const Field::Move& move ) const {
|
||||
if ( !field.InRange( move ) ) {
|
||||
io::stringOut("Wrong input!\n")
|
||||
io::stringOut("Wrong input!\n");
|
||||
return false;
|
||||
} else if ( !field.IsEmpty( move ) ) {
|
||||
io::stringOut("Is occupied!\n");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "tictactoe.h"
|
||||
|
||||
#include "artificia_player.h"
|
||||
#include "artificial_player.h"
|
||||
#include "human_player.h"
|
||||
#include "io.h"
|
||||
|
||||
|
||||
+31
-2
@@ -221,7 +221,8 @@ void Application::handleMessage(MessageEnteredLicense* message)
|
||||
|
||||
void Application::handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
m_project->logStats();
|
||||
logStorageStats();
|
||||
|
||||
if (m_hasGUI)
|
||||
{
|
||||
MessageRefresh().refreshUiOnly().dispatch();
|
||||
@@ -324,6 +325,34 @@ DialogView* Application::getDialogView() const
|
||||
return m_componentManager->getDialogView();
|
||||
}
|
||||
|
||||
static DialogView dialogView;
|
||||
static DialogView dialogView(nullptr);
|
||||
return &dialogView;
|
||||
}
|
||||
|
||||
void Application::logStorageStats() const
|
||||
{
|
||||
if (!ApplicationSettings::getInstance()->getLoggingEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
StorageStats stats = m_storageCache->getStorageStats();
|
||||
|
||||
ss << "\nGraph:\n";
|
||||
ss << "\t" << stats.nodeCount << " Nodes\n";
|
||||
ss << "\t" << stats.edgeCount << " Edges\n";
|
||||
|
||||
ss << "\nCode:\n";
|
||||
ss << "\t" << stats.fileCount << " Files\n";
|
||||
ss << "\t" << stats.fileLOCCount << " Lines of Code\n";
|
||||
|
||||
|
||||
ErrorCountInfo errorCount = m_storageCache->getErrorCount();
|
||||
|
||||
ss << "\nErrors:\n";
|
||||
ss << "\t" << errorCount.total << " Errors\n";
|
||||
ss << "\t" << errorCount.fatal << " Fatal Errors\n";
|
||||
|
||||
LOG_INFO(ss.str());
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ private:
|
||||
void updateRecentProjects(const FilePath& projectSettingsFilePath);
|
||||
|
||||
DialogView* getDialogView() const;
|
||||
void logStorageStats() const;
|
||||
|
||||
const bool m_hasGUI;
|
||||
ProjectFactory m_projectFactory;
|
||||
|
||||
@@ -152,11 +152,6 @@ void Project::setStateSettingsUpdated()
|
||||
}
|
||||
}
|
||||
|
||||
void Project::logStats() const
|
||||
{
|
||||
m_storage->logStats();
|
||||
}
|
||||
|
||||
Project::Project(StorageAccessProxy* storageAccessProxy, DialogView* dialogView)
|
||||
: m_storageAccessProxy(storageAccessProxy)
|
||||
, m_dialogView(dialogView)
|
||||
|
||||
@@ -31,8 +31,6 @@ public:
|
||||
bool settingsEqualExceptNameAndLocation(const ProjectSettings& otherSettings) const;
|
||||
void setStateSettingsUpdated();
|
||||
|
||||
void logStats() const;
|
||||
|
||||
protected:
|
||||
Project(StorageAccessProxy* storageAccessProxy, DialogView* dialogView);
|
||||
DialogView* getDialogView() const;
|
||||
|
||||
@@ -39,6 +39,11 @@ ViewFactory* ComponentFactory::getViewFactory() const
|
||||
return m_viewFactory;
|
||||
}
|
||||
|
||||
StorageAccess* ComponentFactory::getStorageAccess() const
|
||||
{
|
||||
return m_storageAccess;
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createCodeComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<CodeView> view = m_viewFactory->createCodeView(viewLayout);
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
~ComponentFactory();
|
||||
|
||||
ViewFactory* getViewFactory() const;
|
||||
StorageAccess* getStorageAccess() const;
|
||||
|
||||
std::shared_ptr<Component> createCodeComponent(ViewLayout* viewLayout);
|
||||
std::shared_ptr<Component> createErrorComponent(ViewLayout* viewLayout);
|
||||
|
||||
@@ -54,7 +54,7 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
std::shared_ptr<Component> featureComponent = m_componentFactory->createFeatureComponent();
|
||||
m_components.push_back(featureComponent);
|
||||
|
||||
m_dialogView = m_componentFactory->getViewFactory()->createDialogView(viewLayout);
|
||||
m_dialogView = m_componentFactory->getViewFactory()->createDialogView(viewLayout, m_componentFactory->getStorageAccess());
|
||||
|
||||
std::shared_ptr<TabbedView> tabbedView =
|
||||
m_componentFactory->getViewFactory()->createTabbedView(viewLayout, "Log");
|
||||
|
||||
@@ -90,7 +90,7 @@ void CodeController::handleMessage(MessageActivateAll* message)
|
||||
CodeView* view = getView();
|
||||
view->clear();
|
||||
view->setErrorInfos(errors);
|
||||
view->showCodeSnippets(snippets, std::vector<Id>());
|
||||
view->showCodeSnippets(snippets, std::vector<Id>(), true);
|
||||
|
||||
showContents(message);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void CodeController::handleMessage(MessageActivateTokens* message)
|
||||
else
|
||||
{
|
||||
m_collection = m_storageAccess->getTokenLocationsForTokenIds(activeTokenIds);
|
||||
view->showCodeSnippets(getSnippetsForActiveTokenLocations(m_collection.get(), declarationId), activeTokenIds);
|
||||
view->showCodeSnippets(getSnippetsForActiveTokenLocations(m_collection.get(), declarationId), activeTokenIds, true);
|
||||
|
||||
size_t fileCount = m_collection->getTokenLocationFileCount();
|
||||
size_t referenceCount = m_collection->getTokenLocationCount();
|
||||
@@ -281,7 +281,7 @@ void CodeController::handleMessage(MessageShowErrors* message)
|
||||
|
||||
view->clear();
|
||||
view->setErrorInfos(errors);
|
||||
view->showCodeSnippets(snippets, std::vector<Id>());
|
||||
view->showCodeSnippets(snippets, std::vector<Id>(), !message->errorId);
|
||||
|
||||
showContents(message);
|
||||
}
|
||||
@@ -300,7 +300,7 @@ void CodeController::handleMessage(MessageSearchFullText* message)
|
||||
view->clear();
|
||||
|
||||
m_collection = m_storageAccess->getFullTextSearchLocations(message->searchTerm, message->caseSensitive);
|
||||
view->showCodeSnippets(getSnippetsForCollection(m_collection, true), std::vector<Id>());
|
||||
view->showCodeSnippets(getSnippetsForCollection(m_collection, true), std::vector<Id>(), true);
|
||||
|
||||
showContents(message);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void FeatureController::handleMessage(MessageSearch* message)
|
||||
|
||||
case SearchMatch::COMMAND_ERROR:
|
||||
{
|
||||
MessageShowErrors msg(m_storageAccess->getFilteredErrorCount());
|
||||
MessageShowErrors msg(m_storageAccess->getErrorCount());
|
||||
msg.setIsReplayed(message->isReplayed());
|
||||
msg.dispatchImmediately();
|
||||
return;
|
||||
|
||||
@@ -31,13 +31,13 @@ void StatusBarController::handleMessage(MessageClearErrorCount* message)
|
||||
|
||||
void StatusBarController::handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
ErrorCountInfo errorCount = m_storageAccess->getFilteredErrorCount();
|
||||
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
|
||||
getView()->setErrorCount(errorCount);
|
||||
}
|
||||
|
||||
void StatusBarController::handleMessage(MessageRefresh* message)
|
||||
{
|
||||
getView()->setErrorCount(m_storageAccess->getFilteredErrorCount());
|
||||
getView()->setErrorCount(m_storageAccess->getErrorCount());
|
||||
}
|
||||
|
||||
void StatusBarController::handleMessage(MessageShowErrors* message)
|
||||
|
||||
@@ -33,7 +33,8 @@ public:
|
||||
virtual void setErrorInfos(const std::vector<ErrorInfo>& errorInfos) = 0;
|
||||
virtual bool showsErrors() const = 0;
|
||||
|
||||
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds) = 0;
|
||||
virtual void showCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles) = 0;
|
||||
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert) = 0;
|
||||
|
||||
virtual void setFileState(const FilePath filePath, FileState state) = 0;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "component/view/DialogView.h"
|
||||
|
||||
DialogView::DialogView()
|
||||
DialogView::DialogView(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
|
||||
#include "data/ErrorCountInfo.h"
|
||||
|
||||
class StorageAccess;
|
||||
|
||||
class DialogView
|
||||
{
|
||||
public:
|
||||
DialogView();
|
||||
DialogView(StorageAccess* storageAccess);
|
||||
virtual ~DialogView();
|
||||
|
||||
virtual void showProgressDialog(const std::string& title, const std::string& message);
|
||||
@@ -21,6 +23,9 @@ public:
|
||||
|
||||
int confirm(const std::string& message);
|
||||
virtual int confirm(const std::string& message, const std::vector<std::string>& options);
|
||||
|
||||
protected:
|
||||
StorageAccess* m_storageAccess;
|
||||
};
|
||||
|
||||
#endif // DIALOG_VIEW_H
|
||||
|
||||
@@ -14,6 +14,7 @@ class LogView;
|
||||
class RefreshView;
|
||||
class SearchView;
|
||||
class StatusBarView;
|
||||
class StorageAccess;
|
||||
class TabbedView;
|
||||
class UndoRedoView;
|
||||
class ViewLayout;
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
virtual std::shared_ptr<StatusBarView> createStatusBarView(ViewLayout* viewLayout) const = 0;
|
||||
virtual std::shared_ptr<UndoRedoView> createUndoRedoView(ViewLayout* viewLayout) const = 0;
|
||||
|
||||
virtual std::shared_ptr<DialogView> createDialogView(ViewLayout* viewLayout) const = 0;
|
||||
virtual std::shared_ptr<DialogView> createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const = 0;
|
||||
};
|
||||
|
||||
#endif // VIEW_FACTORY_H
|
||||
|
||||
@@ -338,31 +338,6 @@ std::vector<FileInfo> PersistentStorage::getInfoOnAllFiles() const
|
||||
return fileInfos;
|
||||
}
|
||||
|
||||
void PersistentStorage::logStats() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
std::stringstream ss;
|
||||
StorageStats stats = getStorageStats();
|
||||
|
||||
ss << "\nGraph:\n";
|
||||
ss << "\t" << stats.nodeCount << " Nodes\n";
|
||||
ss << "\t" << stats.edgeCount << " Edges\n";
|
||||
|
||||
ss << "\nCode:\n";
|
||||
ss << "\t" << stats.fileCount << " Files\n";
|
||||
ss << "\t" << stats.fileLOCCount << " Lines of Code\n";
|
||||
|
||||
|
||||
ErrorCountInfo errorCount = getErrorCount();
|
||||
|
||||
ss << "\nErrors:\n";
|
||||
ss << "\t" << errorCount.total << " Errors\n";
|
||||
ss << "\t" << errorCount.fatal << " Fatal Errors\n";
|
||||
|
||||
LOG_INFO(ss.str());
|
||||
}
|
||||
|
||||
void PersistentStorage::buildCaches()
|
||||
{
|
||||
TRACE();
|
||||
@@ -1060,10 +1035,10 @@ ErrorCountInfo PersistentStorage::getErrorCount() const
|
||||
return ErrorCountInfo();
|
||||
}
|
||||
|
||||
ErrorCountInfo PersistentStorage::getFilteredErrorCount() const
|
||||
std::vector<StorageError> PersistentStorage::getErrors() const
|
||||
{
|
||||
LOG_ERROR("This should never be called.");
|
||||
return ErrorCountInfo();
|
||||
return std::vector<StorageError>();
|
||||
}
|
||||
|
||||
std::vector<StorageError> PersistentStorage::getAllErrors() const
|
||||
@@ -1071,12 +1046,6 @@ std::vector<StorageError> PersistentStorage::getAllErrors() const
|
||||
return m_sqliteStorage.getAllErrors();
|
||||
}
|
||||
|
||||
std::vector<StorageError> PersistentStorage::getFilteredErrors() const
|
||||
{
|
||||
LOG_ERROR("This should never be called.");
|
||||
return std::vector<StorageError>();
|
||||
}
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> PersistentStorage::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
@@ -65,8 +65,6 @@ public:
|
||||
|
||||
std::vector<FileInfo> getInfoOnAllFiles() const;
|
||||
|
||||
void logStats() const;
|
||||
|
||||
void buildCaches();
|
||||
|
||||
void optimizeMemory();
|
||||
@@ -116,10 +114,8 @@ public:
|
||||
virtual StorageStats getStorageStats() const;
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const;
|
||||
virtual ErrorCountInfo getFilteredErrorCount() const;
|
||||
|
||||
virtual std::vector<StorageError> getErrors() const;
|
||||
virtual std::vector<StorageError> getAllErrors() const;
|
||||
virtual std::vector<StorageError> getFilteredErrors() const;
|
||||
|
||||
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
m_fileRegister->getParsedSourceFilesCount(),
|
||||
m_fileRegister->getSourceFilesCount(),
|
||||
time,
|
||||
m_storageAccess->getFilteredErrorCount()
|
||||
m_storageAccess->getErrorCount()
|
||||
);
|
||||
|
||||
return STATE_SUCCESS;
|
||||
|
||||
@@ -70,10 +70,8 @@ public:
|
||||
virtual StorageStats getStorageStats() const = 0;
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const = 0;
|
||||
virtual ErrorCountInfo getFilteredErrorCount() const = 0;
|
||||
|
||||
virtual std::vector<StorageError> getErrors() const = 0;
|
||||
virtual std::vector<StorageError> getAllErrors() const = 0;
|
||||
virtual std::vector<StorageError> getFilteredErrors() const = 0;
|
||||
|
||||
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const = 0;
|
||||
};
|
||||
|
||||
@@ -274,7 +274,7 @@ ErrorCountInfo StorageAccessProxy::getErrorCount() const
|
||||
{
|
||||
ErrorCountInfo info;
|
||||
|
||||
std::vector<StorageError> storageErrors = getAllErrors();
|
||||
std::vector<StorageError> storageErrors = getErrors();
|
||||
for (const StorageError& error : storageErrors)
|
||||
{
|
||||
info.total++;
|
||||
@@ -288,27 +288,25 @@ ErrorCountInfo StorageAccessProxy::getErrorCount() const
|
||||
return info;
|
||||
}
|
||||
|
||||
ErrorCountInfo StorageAccessProxy::getFilteredErrorCount() const
|
||||
std::vector<StorageError> StorageAccessProxy::getErrors() const
|
||||
{
|
||||
ErrorCountInfo info;
|
||||
|
||||
std::vector<StorageError> storageErrors = getAllErrors();
|
||||
for (const StorageError& error : storageErrors)
|
||||
if (hasSubject())
|
||||
{
|
||||
if (!m_errorFilter.filter(error))
|
||||
std::vector<StorageError> errors = m_subject->getAllErrors();;
|
||||
std::vector<StorageError> filteredErrors;
|
||||
|
||||
for (const StorageError& error : errors)
|
||||
{
|
||||
continue;
|
||||
if (m_errorFilter.filter(error))
|
||||
{
|
||||
filteredErrors.push_back(error);
|
||||
}
|
||||
}
|
||||
|
||||
info.total++;
|
||||
|
||||
if (error.fatal)
|
||||
{
|
||||
info.fatal++;
|
||||
}
|
||||
return filteredErrors;
|
||||
}
|
||||
|
||||
return info;
|
||||
return std::vector<StorageError>();
|
||||
}
|
||||
|
||||
std::vector<StorageError> StorageAccessProxy::getAllErrors() const
|
||||
@@ -321,22 +319,6 @@ std::vector<StorageError> StorageAccessProxy::getAllErrors() const
|
||||
return std::vector<StorageError>();
|
||||
}
|
||||
|
||||
std::vector<StorageError> StorageAccessProxy::getFilteredErrors() const
|
||||
{
|
||||
std::vector<StorageError> errors = getAllErrors();
|
||||
std::vector<StorageError> filteredErrors;
|
||||
|
||||
for (const StorageError& error : errors)
|
||||
{
|
||||
if (m_errorFilter.filter(error))
|
||||
{
|
||||
filteredErrors.push_back(error);
|
||||
}
|
||||
}
|
||||
|
||||
return filteredErrors;
|
||||
}
|
||||
|
||||
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getErrorTokenLocations(std::vector<ErrorInfo>* errors) const
|
||||
{
|
||||
if (hasSubject())
|
||||
@@ -368,5 +350,5 @@ std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getErrorTokenLocati
|
||||
void StorageAccessProxy::handleMessage(MessageErrorFilterChanged* message)
|
||||
{
|
||||
m_errorFilter = message->errorFilter;
|
||||
MessageShowErrors(getFilteredErrorCount()).dispatch();
|
||||
MessageShowErrors(getErrorCount()).dispatch();
|
||||
}
|
||||
|
||||
@@ -65,10 +65,8 @@ public:
|
||||
virtual StorageStats getStorageStats() const;
|
||||
|
||||
virtual ErrorCountInfo getErrorCount() const;
|
||||
virtual ErrorCountInfo getFilteredErrorCount() const;
|
||||
|
||||
virtual std::vector<StorageError> getErrors() const;
|
||||
virtual std::vector<StorageError> getAllErrors() const;
|
||||
virtual std::vector<StorageError> getFilteredErrors() const;
|
||||
|
||||
virtual std::shared_ptr<TokenLocationCollection> getErrorTokenLocations(std::vector<ErrorInfo>* errors) const;
|
||||
|
||||
|
||||
@@ -79,11 +79,13 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
|
||||
column = presumedLocation.getColumn();
|
||||
}
|
||||
|
||||
ParseLocation location(filePath, line, column);
|
||||
|
||||
m_client->onError(
|
||||
ParseLocation(filePath, line, column),
|
||||
location,
|
||||
message,
|
||||
level == clang::DiagnosticsEngine::Fatal,
|
||||
m_register->hasFilePath(filePath)
|
||||
m_register->hasFilePath(location.filePath)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "utility/AppPath.h"
|
||||
#include "utility/UserPaths.h"
|
||||
|
||||
bool appIsMacBundle = false;
|
||||
|
||||
@@ -14,7 +14,8 @@ QtCodeView::QtCodeView(ViewLayout* viewLayout)
|
||||
: CodeView(viewLayout)
|
||||
, m_refreshViewFunctor(std::bind(&QtCodeView::doRefreshView, this))
|
||||
, m_clearFunctor(std::bind(&QtCodeView::doClear, this))
|
||||
, m_showCodeSnippetsFunctor(std::bind(&QtCodeView::doShowCodeSnippets, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_showCodeSnippetsFunctor(
|
||||
std::bind(&QtCodeView::doShowCodeSnippets, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))
|
||||
, m_addCodeSnippetsFunctor(std::bind(&QtCodeView::doAddCodeSnippets, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_setFileStateFunctor(std::bind(&QtCodeView::doSetFileState, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_doShowActiveSnippetFunctor(
|
||||
@@ -66,9 +67,10 @@ bool QtCodeView::showsErrors() const
|
||||
return m_errorInfos.size() > 0;
|
||||
}
|
||||
|
||||
void QtCodeView::showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds)
|
||||
void QtCodeView::showCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles)
|
||||
{
|
||||
m_showCodeSnippetsFunctor(snippets, activeTokenIds);
|
||||
m_showCodeSnippetsFunctor(snippets, activeTokenIds, setupFiles);
|
||||
}
|
||||
|
||||
void QtCodeView::addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert)
|
||||
@@ -136,7 +138,8 @@ void QtCodeView::doClear()
|
||||
m_widget->clearCodeSnippets();
|
||||
}
|
||||
|
||||
void QtCodeView::doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds)
|
||||
void QtCodeView::doShowCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles)
|
||||
{
|
||||
m_widget->setActiveTokenIds(activeTokenIds);
|
||||
m_widget->setErrorInfos(m_errorInfos);
|
||||
@@ -153,7 +156,10 @@ void QtCodeView::doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippe
|
||||
}
|
||||
}
|
||||
|
||||
m_widget->setupFiles();
|
||||
if (setupFiles)
|
||||
{
|
||||
m_widget->setupFiles();
|
||||
}
|
||||
|
||||
setStyleSheet(); // so property "isLast" of QtCodeSnippet is computed correctly
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ public:
|
||||
virtual void setErrorInfos(const std::vector<ErrorInfo>& errorInfos);
|
||||
virtual bool showsErrors() const;
|
||||
|
||||
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds);
|
||||
virtual void showCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles);
|
||||
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
|
||||
|
||||
virtual void setFileState(const FilePath filePath, FileState state);
|
||||
@@ -53,7 +54,8 @@ private:
|
||||
void doRefreshView();
|
||||
void doClear();
|
||||
|
||||
void doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds);
|
||||
void doShowCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles);
|
||||
void doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
|
||||
|
||||
void doSetFileState(const FilePath filePath, FileState state);
|
||||
@@ -75,7 +77,7 @@ private:
|
||||
|
||||
QtThreadedFunctor<> m_refreshViewFunctor;
|
||||
QtThreadedFunctor<> m_clearFunctor;
|
||||
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, const std::vector<Id>&> m_showCodeSnippetsFunctor;
|
||||
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, const std::vector<Id>&, bool> m_showCodeSnippetsFunctor;
|
||||
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, bool> m_addCodeSnippetsFunctor;
|
||||
QtThreadedFunctor<const FilePath, FileState> m_setFileStateFunctor;
|
||||
QtThreadedFunctor<const std::vector<Id>&, std::shared_ptr<TokenLocationCollection>, bool> m_doShowActiveSnippetFunctor;
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "qt/window/QtIndexingDialog.h"
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
QtDialogView::QtDialogView(QtMainWindow* mainWindow)
|
||||
: m_mainWindow(mainWindow)
|
||||
QtDialogView::QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess)
|
||||
: DialogView(storageAccess)
|
||||
, m_mainWindow(mainWindow)
|
||||
, m_windowStack(this)
|
||||
, m_resultReady(false)
|
||||
{
|
||||
@@ -208,6 +210,18 @@ void QtDialogView::handleMessage(MessageInterruptTasks* message)
|
||||
);
|
||||
}
|
||||
|
||||
void QtDialogView::handleMessage(MessageNewErrors* message)
|
||||
{
|
||||
ErrorCountInfo errorInfo = m_storageAccess->getErrorCount();
|
||||
|
||||
m_onQtThread2(
|
||||
[=]()
|
||||
{
|
||||
updateErrorCount(errorInfo.total, errorInfo.fatal);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtDialogView::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
ErrorCountInfo errorInfo = message->errorCount;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
#include "utility/messaging/type/MessageNewErrors.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
#include "utility/messaging/type/MessageWindowClosed.h"
|
||||
|
||||
@@ -17,13 +18,14 @@ class QtDialogView
|
||||
: public QObject
|
||||
, public DialogView
|
||||
, public MessageListener<MessageInterruptTasks>
|
||||
, public MessageListener<MessageNewErrors>
|
||||
, public MessageListener<MessageShowErrors>
|
||||
, public MessageListener<MessageWindowClosed>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtDialogView(QtMainWindow* mainWindow);
|
||||
QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess);
|
||||
virtual ~QtDialogView();
|
||||
|
||||
void showProgressDialog(const std::string& title, const std::string& message) override;
|
||||
@@ -37,6 +39,7 @@ public:
|
||||
|
||||
private:
|
||||
void handleMessage(MessageInterruptTasks* message) override;
|
||||
void handleMessage(MessageNewErrors* message) override;
|
||||
void handleMessage(MessageShowErrors* message) override;
|
||||
void handleMessage(MessageWindowClosed* message) override;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void QtErrorView::initView()
|
||||
m_table->setModel(m_model);
|
||||
|
||||
// Setup Table Headers
|
||||
m_model->setColumnCount(5);
|
||||
m_model->setColumnCount(6);
|
||||
m_table->setColumnWidth(COLUMN::TYPE, 70);
|
||||
m_table->setColumnWidth(COLUMN::MESSAGE, 450);
|
||||
m_table->setColumnWidth(COLUMN::FILE, 300);
|
||||
|
||||
@@ -86,7 +86,7 @@ std::shared_ptr<UndoRedoView> QtViewFactory::createUndoRedoView(ViewLayout* view
|
||||
return View::createInitAndAddToLayout<QtUndoRedoView>(viewLayout);
|
||||
}
|
||||
|
||||
std::shared_ptr<DialogView> QtViewFactory::createDialogView(ViewLayout* viewLayout) const
|
||||
std::shared_ptr<DialogView> QtViewFactory::createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const
|
||||
{
|
||||
return std::make_shared<QtDialogView>(dynamic_cast<QtMainView*>(viewLayout)->getMainWindow());
|
||||
return std::make_shared<QtDialogView>(dynamic_cast<QtMainView*>(viewLayout)->getMainWindow(), storageAccess);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual std::shared_ptr<StatusBarView> createStatusBarView(ViewLayout* viewLayout) const;
|
||||
virtual std::shared_ptr<UndoRedoView> createUndoRedoView(ViewLayout* viewLayout) const;
|
||||
|
||||
virtual std::shared_ptr<DialogView> createDialogView(ViewLayout* viewLayout) const;
|
||||
virtual std::shared_ptr<DialogView> createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const;
|
||||
};
|
||||
|
||||
#endif // QT_VIEW_FACTORY_H
|
||||
|
||||
Reference in New Issue
Block a user