From 149a3057613d0d184c85303d66113f7884922063 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 13 Oct 2016 14:21:22 +0200 Subject: [PATCH] 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 --- bin/app/data/color_schemes/bad_rainbow.xml | 18 ++++---- bin/app/data/color_schemes/dark.xml | 4 +- bin/app/data/projects/tictactoe/src/field.cpp | 4 +- .../projects/tictactoe/src/human_player.cpp | 6 +-- .../data/projects/tictactoe/src/tictactoe.cpp | 2 +- src/lib/Application.cpp | 33 ++++++++++++- src/lib/Application.h | 1 + src/lib/Project.cpp | 5 -- src/lib/Project.h | 2 - src/lib/component/ComponentFactory.cpp | 5 ++ src/lib/component/ComponentFactory.h | 1 + src/lib/component/ComponentManager.cpp | 2 +- .../component/controller/CodeController.cpp | 8 ++-- .../controller/FeatureController.cpp | 2 +- .../controller/StatusBarController.cpp | 4 +- src/lib/component/view/CodeView.h | 3 +- src/lib/component/view/DialogView.cpp | 3 +- src/lib/component/view/DialogView.h | 7 ++- src/lib/component/view/ViewFactory.h | 3 +- src/lib/data/PersistentStorage.cpp | 35 +------------- src/lib/data/PersistentStorage.h | 6 +-- src/lib/data/TaskFinishParsing.cpp | 2 +- src/lib/data/access/StorageAccess.h | 4 +- src/lib/data/access/StorageAccessProxy.cpp | 46 ++++++------------- src/lib/data/access/StorageAccessProxy.h | 4 +- .../data/parser/cxx/CxxDiagnosticConsumer.cpp | 6 ++- src/lib_gui/platform_includes/includesMac.h | 1 + src/lib_gui/qt/view/QtCodeView.cpp | 16 +++++-- src/lib_gui/qt/view/QtCodeView.h | 8 ++-- src/lib_gui/qt/view/QtDialogView.cpp | 18 +++++++- src/lib_gui/qt/view/QtDialogView.h | 5 +- src/lib_gui/qt/view/QtErrorView.cpp | 2 +- src/lib_gui/qt/view/QtViewFactory.cpp | 4 +- src/lib_gui/qt/view/QtViewFactory.h | 2 +- 34 files changed, 140 insertions(+), 132 deletions(-) diff --git a/bin/app/data/color_schemes/bad_rainbow.xml b/bin/app/data/color_schemes/bad_rainbow.xml index e53ff353..275d5223 100644 --- a/bin/app/data/color_schemes/bad_rainbow.xml +++ b/bin/app/data/color_schemes/bad_rainbow.xml @@ -394,24 +394,24 @@ - #272728 - white
+ #494949 + #C4C4C4
- white + #C4C4C4 black - darkgrey - white + #494949 + #7B7B7B - #343434 - white + #383838 + #7B7B7B
- #272728 - white + #494949 + #C4C4C4 #878787 #878787 diff --git a/bin/app/data/color_schemes/dark.xml b/bin/app/data/color_schemes/dark.xml index 47a74c48..3d59fbcc 100644 --- a/bin/app/data/color_schemes/dark.xml +++ b/bin/app/data/color_schemes/dark.xml @@ -397,11 +397,11 @@ darkgrey - white + #969696 #343434 - white + #969696 diff --git a/bin/app/data/projects/tictactoe/src/field.cpp b/bin/app/data/projects/tictactoe/src/field.cpp index da8ca996..d87128a8 100644 --- a/bin/app/data/projects/tictactoe/src/field.cpp +++ b/bin/app/data/projects/tictactoe/src/field.cpp @@ -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 { diff --git a/bin/app/data/projects/tictactoe/src/human_player.cpp b/bin/app/data/projects/tictactoe/src/human_player.cpp index 898ac14c..4357d897 100644 --- a/bin/app/data/projects/tictactoe/src/human_player.cpp +++ b/bin/app/data/projects/tictactoe/src/human_player.cpp @@ -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"); diff --git a/bin/app/data/projects/tictactoe/src/tictactoe.cpp b/bin/app/data/projects/tictactoe/src/tictactoe.cpp index 95882df7..d21a1025 100644 --- a/bin/app/data/projects/tictactoe/src/tictactoe.cpp +++ b/bin/app/data/projects/tictactoe/src/tictactoe.cpp @@ -1,6 +1,6 @@ #include "tictactoe.h" -#include "artificia_player.h" +#include "artificial_player.h" #include "human_player.h" #include "io.h" diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index 24740ac5..1acca0dd 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -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()); +} diff --git a/src/lib/Application.h b/src/lib/Application.h index 94aea5af..b4e44ef0 100644 --- a/src/lib/Application.h +++ b/src/lib/Application.h @@ -73,6 +73,7 @@ private: void updateRecentProjects(const FilePath& projectSettingsFilePath); DialogView* getDialogView() const; + void logStorageStats() const; const bool m_hasGUI; ProjectFactory m_projectFactory; diff --git a/src/lib/Project.cpp b/src/lib/Project.cpp index 5082c352..122330d9 100644 --- a/src/lib/Project.cpp +++ b/src/lib/Project.cpp @@ -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) diff --git a/src/lib/Project.h b/src/lib/Project.h index 0aab8dd6..d21b7c8b 100644 --- a/src/lib/Project.h +++ b/src/lib/Project.h @@ -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; diff --git a/src/lib/component/ComponentFactory.cpp b/src/lib/component/ComponentFactory.cpp index 8ee028ad..8e80f2fc 100644 --- a/src/lib/component/ComponentFactory.cpp +++ b/src/lib/component/ComponentFactory.cpp @@ -39,6 +39,11 @@ ViewFactory* ComponentFactory::getViewFactory() const return m_viewFactory; } +StorageAccess* ComponentFactory::getStorageAccess() const +{ + return m_storageAccess; +} + std::shared_ptr ComponentFactory::createCodeComponent(ViewLayout* viewLayout) { std::shared_ptr view = m_viewFactory->createCodeView(viewLayout); diff --git a/src/lib/component/ComponentFactory.h b/src/lib/component/ComponentFactory.h index 93c6759e..192cecae 100644 --- a/src/lib/component/ComponentFactory.h +++ b/src/lib/component/ComponentFactory.h @@ -17,6 +17,7 @@ public: ~ComponentFactory(); ViewFactory* getViewFactory() const; + StorageAccess* getStorageAccess() const; std::shared_ptr createCodeComponent(ViewLayout* viewLayout); std::shared_ptr createErrorComponent(ViewLayout* viewLayout); diff --git a/src/lib/component/ComponentManager.cpp b/src/lib/component/ComponentManager.cpp index c21ef1cd..3d4fa564 100644 --- a/src/lib/component/ComponentManager.cpp +++ b/src/lib/component/ComponentManager.cpp @@ -54,7 +54,7 @@ void ComponentManager::setup(ViewLayout* viewLayout) std::shared_ptr 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 = m_componentFactory->getViewFactory()->createTabbedView(viewLayout, "Log"); diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 6d680b6f..da4c7bf6 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -90,7 +90,7 @@ void CodeController::handleMessage(MessageActivateAll* message) CodeView* view = getView(); view->clear(); view->setErrorInfos(errors); - view->showCodeSnippets(snippets, std::vector()); + view->showCodeSnippets(snippets, std::vector(), 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()); + view->showCodeSnippets(snippets, std::vector(), !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()); + view->showCodeSnippets(getSnippetsForCollection(m_collection, true), std::vector(), true); showContents(message); } diff --git a/src/lib/component/controller/FeatureController.cpp b/src/lib/component/controller/FeatureController.cpp index b9aeb72f..d8c006ff 100644 --- a/src/lib/component/controller/FeatureController.cpp +++ b/src/lib/component/controller/FeatureController.cpp @@ -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; diff --git a/src/lib/component/controller/StatusBarController.cpp b/src/lib/component/controller/StatusBarController.cpp index 757fef71..4ad05d8a 100644 --- a/src/lib/component/controller/StatusBarController.cpp +++ b/src/lib/component/controller/StatusBarController.cpp @@ -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) diff --git a/src/lib/component/view/CodeView.h b/src/lib/component/view/CodeView.h index 8ad7f6de..621658c6 100644 --- a/src/lib/component/view/CodeView.h +++ b/src/lib/component/view/CodeView.h @@ -33,7 +33,8 @@ public: virtual void setErrorInfos(const std::vector& errorInfos) = 0; virtual bool showsErrors() const = 0; - virtual void showCodeSnippets(const std::vector& snippets, const std::vector& activeTokenIds) = 0; + virtual void showCodeSnippets( + const std::vector& snippets, const std::vector& activeTokenIds, bool setupFiles) = 0; virtual void addCodeSnippets(const std::vector& snippets, bool insert) = 0; virtual void setFileState(const FilePath filePath, FileState state) = 0; diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index c8e81f2e..40c66b1b 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -1,6 +1,7 @@ #include "component/view/DialogView.h" -DialogView::DialogView() +DialogView::DialogView(StorageAccess* storageAccess) + : m_storageAccess(storageAccess) { } diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index df84774b..e5107f78 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -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& options); + +protected: + StorageAccess* m_storageAccess; }; #endif // DIALOG_VIEW_H diff --git a/src/lib/component/view/ViewFactory.h b/src/lib/component/view/ViewFactory.h index b35974a3..ffbc2430 100644 --- a/src/lib/component/view/ViewFactory.h +++ b/src/lib/component/view/ViewFactory.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 createStatusBarView(ViewLayout* viewLayout) const = 0; virtual std::shared_ptr createUndoRedoView(ViewLayout* viewLayout) const = 0; - virtual std::shared_ptr createDialogView(ViewLayout* viewLayout) const = 0; + virtual std::shared_ptr createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const = 0; }; #endif // VIEW_FACTORY_H diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/PersistentStorage.cpp index b3482ac0..e5d98e5f 100644 --- a/src/lib/data/PersistentStorage.cpp +++ b/src/lib/data/PersistentStorage.cpp @@ -338,31 +338,6 @@ std::vector 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 PersistentStorage::getErrors() const { LOG_ERROR("This should never be called."); - return ErrorCountInfo(); + return std::vector(); } std::vector PersistentStorage::getAllErrors() const @@ -1071,12 +1046,6 @@ std::vector PersistentStorage::getAllErrors() const return m_sqliteStorage.getAllErrors(); } -std::vector PersistentStorage::getFilteredErrors() const -{ - LOG_ERROR("This should never be called."); - return std::vector(); -} - std::shared_ptr PersistentStorage::getErrorTokenLocations(std::vector* errors) const { TRACE(); diff --git a/src/lib/data/PersistentStorage.h b/src/lib/data/PersistentStorage.h index 7a367f01..cd805d62 100644 --- a/src/lib/data/PersistentStorage.h +++ b/src/lib/data/PersistentStorage.h @@ -65,8 +65,6 @@ public: std::vector 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 getErrors() const; virtual std::vector getAllErrors() const; - virtual std::vector getFilteredErrors() const; virtual std::shared_ptr getErrorTokenLocations(std::vector* errors) const; diff --git a/src/lib/data/TaskFinishParsing.cpp b/src/lib/data/TaskFinishParsing.cpp index ba859f3d..29644656 100644 --- a/src/lib/data/TaskFinishParsing.cpp +++ b/src/lib/data/TaskFinishParsing.cpp @@ -61,7 +61,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr blackboa m_fileRegister->getParsedSourceFilesCount(), m_fileRegister->getSourceFilesCount(), time, - m_storageAccess->getFilteredErrorCount() + m_storageAccess->getErrorCount() ); return STATE_SUCCESS; diff --git a/src/lib/data/access/StorageAccess.h b/src/lib/data/access/StorageAccess.h index d852ddf5..4cd873b3 100644 --- a/src/lib/data/access/StorageAccess.h +++ b/src/lib/data/access/StorageAccess.h @@ -70,10 +70,8 @@ public: virtual StorageStats getStorageStats() const = 0; virtual ErrorCountInfo getErrorCount() const = 0; - virtual ErrorCountInfo getFilteredErrorCount() const = 0; - + virtual std::vector getErrors() const = 0; virtual std::vector getAllErrors() const = 0; - virtual std::vector getFilteredErrors() const = 0; virtual std::shared_ptr getErrorTokenLocations(std::vector* errors) const = 0; }; diff --git a/src/lib/data/access/StorageAccessProxy.cpp b/src/lib/data/access/StorageAccessProxy.cpp index b97fc0cb..1ed2ad42 100644 --- a/src/lib/data/access/StorageAccessProxy.cpp +++ b/src/lib/data/access/StorageAccessProxy.cpp @@ -274,7 +274,7 @@ ErrorCountInfo StorageAccessProxy::getErrorCount() const { ErrorCountInfo info; - std::vector storageErrors = getAllErrors(); + std::vector 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 StorageAccessProxy::getErrors() const { - ErrorCountInfo info; - - std::vector storageErrors = getAllErrors(); - for (const StorageError& error : storageErrors) + if (hasSubject()) { - if (!m_errorFilter.filter(error)) + std::vector errors = m_subject->getAllErrors();; + std::vector 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(); } std::vector StorageAccessProxy::getAllErrors() const @@ -321,22 +319,6 @@ std::vector StorageAccessProxy::getAllErrors() const return std::vector(); } -std::vector StorageAccessProxy::getFilteredErrors() const -{ - std::vector errors = getAllErrors(); - std::vector filteredErrors; - - for (const StorageError& error : errors) - { - if (m_errorFilter.filter(error)) - { - filteredErrors.push_back(error); - } - } - - return filteredErrors; -} - std::shared_ptr StorageAccessProxy::getErrorTokenLocations(std::vector* errors) const { if (hasSubject()) @@ -368,5 +350,5 @@ std::shared_ptr StorageAccessProxy::getErrorTokenLocati void StorageAccessProxy::handleMessage(MessageErrorFilterChanged* message) { m_errorFilter = message->errorFilter; - MessageShowErrors(getFilteredErrorCount()).dispatch(); + MessageShowErrors(getErrorCount()).dispatch(); } diff --git a/src/lib/data/access/StorageAccessProxy.h b/src/lib/data/access/StorageAccessProxy.h index d085b958..da1c3e37 100644 --- a/src/lib/data/access/StorageAccessProxy.h +++ b/src/lib/data/access/StorageAccessProxy.h @@ -65,10 +65,8 @@ public: virtual StorageStats getStorageStats() const; virtual ErrorCountInfo getErrorCount() const; - virtual ErrorCountInfo getFilteredErrorCount() const; - + virtual std::vector getErrors() const; virtual std::vector getAllErrors() const; - virtual std::vector getFilteredErrors() const; virtual std::shared_ptr getErrorTokenLocations(std::vector* errors) const; diff --git a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp index 29c74ad2..3a473a01 100644 --- a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp @@ -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) ); } } diff --git a/src/lib_gui/platform_includes/includesMac.h b/src/lib_gui/platform_includes/includesMac.h index 1a5b2d13..a84ea0bf 100644 --- a/src/lib_gui/platform_includes/includesMac.h +++ b/src/lib_gui/platform_includes/includesMac.h @@ -7,6 +7,7 @@ #include #include "qt/utility/utilityQt.h" +#include "utility/AppPath.h" #include "utility/UserPaths.h" bool appIsMacBundle = false; diff --git a/src/lib_gui/qt/view/QtCodeView.cpp b/src/lib_gui/qt/view/QtCodeView.cpp index 26edc867..5914e861 100644 --- a/src/lib_gui/qt/view/QtCodeView.cpp +++ b/src/lib_gui/qt/view/QtCodeView.cpp @@ -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& snippets, const std::vector& activeTokenIds) +void QtCodeView::showCodeSnippets( + const std::vector& snippets, const std::vector& activeTokenIds, bool setupFiles) { - m_showCodeSnippetsFunctor(snippets, activeTokenIds); + m_showCodeSnippetsFunctor(snippets, activeTokenIds, setupFiles); } void QtCodeView::addCodeSnippets(const std::vector& snippets, bool insert) @@ -136,7 +138,8 @@ void QtCodeView::doClear() m_widget->clearCodeSnippets(); } -void QtCodeView::doShowCodeSnippets(const std::vector& snippets, const std::vector& activeTokenIds) +void QtCodeView::doShowCodeSnippets( + const std::vector& snippets, const std::vector& activeTokenIds, bool setupFiles) { m_widget->setActiveTokenIds(activeTokenIds); m_widget->setErrorInfos(m_errorInfos); @@ -153,7 +156,10 @@ void QtCodeView::doShowCodeSnippets(const std::vector& snippe } } - m_widget->setupFiles(); + if (setupFiles) + { + m_widget->setupFiles(); + } setStyleSheet(); // so property "isLast" of QtCodeSnippet is computed correctly } diff --git a/src/lib_gui/qt/view/QtCodeView.h b/src/lib_gui/qt/view/QtCodeView.h index c679f455..74013b47 100644 --- a/src/lib_gui/qt/view/QtCodeView.h +++ b/src/lib_gui/qt/view/QtCodeView.h @@ -31,7 +31,8 @@ public: virtual void setErrorInfos(const std::vector& errorInfos); virtual bool showsErrors() const; - virtual void showCodeSnippets(const std::vector& snippets, const std::vector& activeTokenIds); + virtual void showCodeSnippets( + const std::vector& snippets, const std::vector& activeTokenIds, bool setupFiles); virtual void addCodeSnippets(const std::vector& 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& snippets, const std::vector& activeTokenIds); + void doShowCodeSnippets( + const std::vector& snippets, const std::vector& activeTokenIds, bool setupFiles); void doAddCodeSnippets(const std::vector& 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&> m_showCodeSnippetsFunctor; + QtThreadedFunctor&, const std::vector&, bool> m_showCodeSnippetsFunctor; QtThreadedFunctor&, bool> m_addCodeSnippetsFunctor; QtThreadedFunctor m_setFileStateFunctor; QtThreadedFunctor&, std::shared_ptr, bool> m_doShowActiveSnippetFunctor; diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 56d44d10..6902eca9 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -6,13 +6,15 @@ #include +#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; diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index 49963829..a727cb27 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -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 + , public MessageListener , public MessageListener , public MessageListener { 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; diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index c08fd7c0..ffc76e70 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -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); diff --git a/src/lib_gui/qt/view/QtViewFactory.cpp b/src/lib_gui/qt/view/QtViewFactory.cpp index b9eff60a..432d2470 100644 --- a/src/lib_gui/qt/view/QtViewFactory.cpp +++ b/src/lib_gui/qt/view/QtViewFactory.cpp @@ -86,7 +86,7 @@ std::shared_ptr QtViewFactory::createUndoRedoView(ViewLayout* view return View::createInitAndAddToLayout(viewLayout); } -std::shared_ptr QtViewFactory::createDialogView(ViewLayout* viewLayout) const +std::shared_ptr QtViewFactory::createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const { - return std::make_shared(dynamic_cast(viewLayout)->getMainWindow()); + return std::make_shared(dynamic_cast(viewLayout)->getMainWindow(), storageAccess); } diff --git a/src/lib_gui/qt/view/QtViewFactory.h b/src/lib_gui/qt/view/QtViewFactory.h index 9fa801bc..43a41bea 100644 --- a/src/lib_gui/qt/view/QtViewFactory.h +++ b/src/lib_gui/qt/view/QtViewFactory.h @@ -23,7 +23,7 @@ public: virtual std::shared_ptr createStatusBarView(ViewLayout* viewLayout) const; virtual std::shared_ptr createUndoRedoView(ViewLayout* viewLayout) const; - virtual std::shared_ptr createDialogView(ViewLayout* viewLayout) const; + virtual std::shared_ptr createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const; }; #endif // QT_VIEW_FACTORY_H