diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index d2b871a6..e1c54358 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -2,6 +2,20 @@ add_files( LIB + app/paths/AppPath.cpp + app/paths/AppPath.h + app/paths/ResourcePaths.cpp + app/paths/ResourcePaths.h + app/paths/UserPaths.cpp + app/paths/UserPaths.h + + app/Application.cpp + app/Application.h + app/LanguagePackage.h + app/LanguagePackageManager.cpp + app/LanguagePackageManager.h + app/UpdateChecker.h + component/controller/helper/BucketLayouter.cpp component/controller/helper/BucketLayouter.h component/controller/helper/DummyEdge.h @@ -107,10 +121,6 @@ add_files( component/TabId.cpp component/TabId.h - data/access/StorageAccess.h - data/access/StorageAccessProxy.cpp - data/access/StorageAccessProxy.h - data/bookmark/Bookmark.cpp data/bookmark/Bookmark.h data/bookmark/BookmarkCategory.cpp @@ -268,6 +278,9 @@ add_files( data/storage/PersistentStorage.h data/storage/Storage.cpp data/storage/Storage.h + data/storage/StorageAccess.h + data/storage/StorageAccessProxy.cpp + data/storage/StorageAccessProxy.h data/storage/StorageCache.cpp data/storage/StorageCache.h data/storage/StorageProvider.cpp @@ -423,6 +436,8 @@ add_files( utility/file/FileSystem.h utility/file/FileTree.cpp utility/file/FileTree.h + utility/file/utilityFile.cpp + utility/file/utilityFile.h utility/interprocess/SharedMemory.cpp utility/interprocess/SharedMemory.h @@ -619,8 +634,6 @@ add_files( utility/text/TextAccess.h utility/ApplicationArchitectureType.h - utility/AppPath.cpp - utility/AppPath.h utility/ConfigManager.cpp utility/ConfigManager.h utility/LowMemoryStringMap.h @@ -628,8 +641,6 @@ add_files( utility/OrderedCache.h utility/OsType.h utility/Property.h - utility/ResourcePaths.cpp - utility/ResourcePaths.h utility/ScopedFunctor.cpp utility/ScopedFunctor.h utility/ScopedSwitcher.h @@ -641,26 +652,13 @@ add_files( utility/Tree.h utility/types.h utility/UnorderedCache.h - utility/UserPaths.cpp - utility/UserPaths.h utility/utility.cpp utility/utility.h - utility/utilityFile.cpp - utility/utilityFile.h utility/utilityLibrary.h - utility/utilityMath.cpp - utility/utilityMath.h utility/utilityUuid.cpp utility/utilityUuid.h utility/utilityWindows.cpp utility/utilityWindows.h utility/utilityXml.cpp utility/utilityXml.h - - Application.cpp - Application.h - LanguagePackage.h - LanguagePackageManager.cpp - LanguagePackageManager.h - UpdateChecker.h ) diff --git a/src/lib/Application.cpp b/src/lib/app/Application.cpp similarity index 97% rename from src/lib/Application.cpp rename to src/lib/app/Application.cpp index c4f3ac83..ed653cfb 100644 --- a/src/lib/Application.cpp +++ b/src/lib/app/Application.cpp @@ -165,16 +165,6 @@ bool Application::hasGUI() return m_hasGUI; } -int Application::handleDialog(const std::string& message) -{ - return getDialogView(DialogView::UseCase::GENERAL)->confirm(message); -} - -int Application::handleDialog(const std::string& message, const std::vector& options) -{ - return getDialogView(DialogView::UseCase::GENERAL)->confirm(message, options); -} - int Application::handleDialog(const std::wstring& message) { return getDialogView(DialogView::UseCase::GENERAL)->confirm(message); diff --git a/src/lib/Application.h b/src/lib/app/Application.h similarity index 95% rename from src/lib/Application.h rename to src/lib/app/Application.h index b78d246c..7d788215 100644 --- a/src/lib/Application.h +++ b/src/lib/app/Application.h @@ -53,8 +53,6 @@ public: bool hasGUI(); - int handleDialog(const std::string& message); - int handleDialog(const std::string& message, const std::vector& options); int handleDialog(const std::wstring& message); int handleDialog(const std::wstring& message, const std::vector& options); std::shared_ptr getDialogView(DialogView::UseCase useCase); diff --git a/src/lib/LanguagePackage.h b/src/lib/app/LanguagePackage.h similarity index 100% rename from src/lib/LanguagePackage.h rename to src/lib/app/LanguagePackage.h diff --git a/src/lib/LanguagePackageManager.cpp b/src/lib/app/LanguagePackageManager.cpp similarity index 100% rename from src/lib/LanguagePackageManager.cpp rename to src/lib/app/LanguagePackageManager.cpp diff --git a/src/lib/LanguagePackageManager.h b/src/lib/app/LanguagePackageManager.h similarity index 100% rename from src/lib/LanguagePackageManager.h rename to src/lib/app/LanguagePackageManager.h diff --git a/src/lib/UpdateChecker.h b/src/lib/app/UpdateChecker.h similarity index 100% rename from src/lib/UpdateChecker.h rename to src/lib/app/UpdateChecker.h diff --git a/src/lib/utility/AppPath.cpp b/src/lib/app/paths/AppPath.cpp similarity index 100% rename from src/lib/utility/AppPath.cpp rename to src/lib/app/paths/AppPath.cpp diff --git a/src/lib/utility/AppPath.h b/src/lib/app/paths/AppPath.h similarity index 100% rename from src/lib/utility/AppPath.h rename to src/lib/app/paths/AppPath.h diff --git a/src/lib/utility/ResourcePaths.cpp b/src/lib/app/paths/ResourcePaths.cpp similarity index 100% rename from src/lib/utility/ResourcePaths.cpp rename to src/lib/app/paths/ResourcePaths.cpp diff --git a/src/lib/utility/ResourcePaths.h b/src/lib/app/paths/ResourcePaths.h similarity index 100% rename from src/lib/utility/ResourcePaths.h rename to src/lib/app/paths/ResourcePaths.h diff --git a/src/lib/utility/UserPaths.cpp b/src/lib/app/paths/UserPaths.cpp similarity index 100% rename from src/lib/utility/UserPaths.cpp rename to src/lib/app/paths/UserPaths.cpp diff --git a/src/lib/utility/UserPaths.h b/src/lib/app/paths/UserPaths.h similarity index 100% rename from src/lib/utility/UserPaths.h rename to src/lib/app/paths/UserPaths.h diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 2c30f528..b2e3f175 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -2,19 +2,20 @@ #include -#include "StorageAccess.h" -#include "SourceLocation.h" -#include "SourceLocationCollection.h" -#include "SourceLocationFile.h" +#include "Application.h" #include "ApplicationSettings.h" #include "FileInfo.h" #include "logging.h" #include "MessageMoveIDECursor.h" #include "MessageStatus.h" +#include "StorageAccess.h" +#include "SourceLocation.h" +#include "SourceLocationCollection.h" +#include "SourceLocationFile.h" #include "TextAccess.h" #include "tracing.h" +#include "utility.h" #include "utilityString.h" -#include "Application.h" CodeController::CodeController(StorageAccess* storageAccess) : m_storageAccess(storageAccess) @@ -26,8 +27,6 @@ Id CodeController::getSchedulerId() const return Controller::getTabId(); } -const uint CodeController::s_lineRadius = 2; - void CodeController::handleMessage(MessageActivateAll* message) { TRACE("code all"); diff --git a/src/lib/component/controller/CodeController.h b/src/lib/component/controller/CodeController.h index f2e55b02..f32a62c5 100644 --- a/src/lib/component/controller/CodeController.h +++ b/src/lib/component/controller/CodeController.h @@ -63,8 +63,6 @@ public: Id getSchedulerId() const override; private: - static const uint s_lineRadius; - void handleMessage(MessageActivateAll* message) override; void handleMessage(MessageActivateErrors* message) override; void handleMessage(MessageActivateFullTextSearch* message) override; diff --git a/src/lib/component/controller/Controller.cpp b/src/lib/component/controller/Controller.cpp index f98e929f..4c3a5751 100644 --- a/src/lib/component/controller/Controller.cpp +++ b/src/lib/component/controller/Controller.cpp @@ -1,4 +1,4 @@ -#include "component/controller/Controller.h" +#include "Controller.h" Controller::Controller() : m_component(nullptr) diff --git a/src/lib/component/controller/ErrorController.cpp b/src/lib/component/controller/ErrorController.cpp index 51851ab0..9490554a 100644 --- a/src/lib/component/controller/ErrorController.cpp +++ b/src/lib/component/controller/ErrorController.cpp @@ -127,8 +127,8 @@ void ErrorController::handleMessage(MessageErrorsForFile* message) Project* project = Application::getInstance()->getCurrentProject().get(); if (project && project->isIndexing()) { - Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm( - "Showing errors for a file is not possible while indexing." + Application::getInstance()->handleDialog( + L"Showing errors for a file is not possible while indexing." ); return; } diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 68f20bda..0c464b94 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -244,11 +244,11 @@ void GraphController::handleMessage(MessageActivateTrail* message) if (graph->getNodeCount() > 1000) { int r = Application::getInstance()->handleDialog( - "Warning!\n\nThe resulting depth graph will contain " + std::to_string(graph->getNodeCount()) + " nodes. " - "Layouting and drawing might take a while and the resulting graph diagram could be unclear. Please " - "consider reducing graph depth with the slider on the left.\n\n" - "Do you want to proceed?", - {"Yes", "No"} + L"Warning!\n\nThe resulting depth graph will contain " + std::to_wstring(graph->getNodeCount()) + " nodes. " + L"Layouting and drawing might take a while and the resulting graph diagram could be unclear. Please " + L"consider reducing graph depth with the slider on the left.\n\n" + L"Do you want to proceed?", + { L"Yes", L"No" } ); if (r == 1) diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index 2cf5caed..481a04c1 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -515,9 +515,7 @@ void UndoRedoController::replayCommand(std::list::iterator it) Project* project = Application::getInstance()->getCurrentProject().get(); if (project && project->isIndexing()) { - Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm( - "Errors cannot be activated while indexing." - ); + Application::getInstance()->handleDialog(L"Errors cannot be activated while indexing."); ErrorFilter filter; filter.error = false; diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index c30a6465..906d613e 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -64,16 +64,6 @@ DatabasePolicy DialogView::finishedIndexingDialog( return DATABASE_POLICY_KEEP; // used in non-gui mode } -int DialogView::confirm(const std::string& message) -{ - return confirm(message, std::vector()); -} - -int DialogView::confirm(const std::string& message, const std::vector& options) -{ - return -1; -} - int DialogView::confirm(const std::wstring& message) { return confirm(message, std::vector()); diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index 6d575bef..d7fbb719 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -55,8 +55,6 @@ public: size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted); - int confirm(const std::string& message); - virtual int confirm(const std::string& message, const std::vector& options); int confirm(const std::wstring& message); virtual int confirm(const std::wstring& message, const std::vector& options); diff --git a/src/lib/component/view/helper/CodeSnippetParams.h b/src/lib/component/view/helper/CodeSnippetParams.h index 69035e05..cb966234 100644 --- a/src/lib/component/view/helper/CodeSnippetParams.h +++ b/src/lib/component/view/helper/CodeSnippetParams.h @@ -16,8 +16,8 @@ struct CodeSnippetParams static bool sort(const CodeSnippetParams& a, const CodeSnippetParams& b); static bool sortById(const CodeSnippetParams& a, const CodeSnippetParams& b); - uint startLineNumber; - uint endLineNumber; + size_t startLineNumber; + size_t endLineNumber; std::wstring title; std::wstring footer; diff --git a/src/lib/data/ErrorInfo.h b/src/lib/data/ErrorInfo.h index 9fa9a689..03288959 100644 --- a/src/lib/data/ErrorInfo.h +++ b/src/lib/data/ErrorInfo.h @@ -21,8 +21,8 @@ struct ErrorInfo Id id, std::wstring message, std::wstring filePath, - uint lineNumber, - uint columnNumber, + size_t lineNumber, + size_t columnNumber, std::wstring translationUnit, bool fatal, bool indexed @@ -42,8 +42,8 @@ struct ErrorInfo std::wstring message; std::wstring filePath; - uint lineNumber; - uint columnNumber; + size_t lineNumber; + size_t columnNumber; std::wstring translationUnit; bool fatal; diff --git a/src/lib/data/NodeTypeSet.cpp b/src/lib/data/NodeTypeSet.cpp index 63c3bff5..4e7d06ee 100644 --- a/src/lib/data/NodeTypeSet.cpp +++ b/src/lib/data/NodeTypeSet.cpp @@ -2,7 +2,6 @@ #include "NodeType.h" #include "utility.h" -#include "utilityMath.h" NodeTypeSet NodeTypeSet::all() { diff --git a/src/lib/data/TaskCleanStorage.cpp b/src/lib/data/TaskCleanStorage.cpp index 481f9962..a3a40752 100644 --- a/src/lib/data/TaskCleanStorage.cpp +++ b/src/lib/data/TaskCleanStorage.cpp @@ -4,7 +4,6 @@ #include "PersistentStorage.h" #include "FilePath.h" #include "Blackboard.h" -#include "utility.h" #include "Application.h" TaskCleanStorage::TaskCleanStorage( @@ -22,7 +21,7 @@ void TaskCleanStorage::doEnter(std::shared_ptr blackboard) { m_dialogView->showUnknownProgressDialog(L"Clearing Files", std::to_wstring(m_filePaths.size()) + L" Files"); - m_start = utility::durationStart(); + m_start = TimeStamp::now(); if (!m_filePaths.empty() || m_clearAllErrors) { @@ -56,7 +55,7 @@ Task::TaskState TaskCleanStorage::doUpdate(std::shared_ptr blackboar void TaskCleanStorage::doExit(std::shared_ptr blackboard) { - blackboard->set("clear_time", utility::duration(m_start)); + blackboard->set("clear_time", TimeStamp::durationSeconds(m_start)); m_dialogView->hideProgressDialog(); } diff --git a/src/lib/data/TaskFinishParsing.cpp b/src/lib/data/TaskFinishParsing.cpp index 252ff091..277eaf6f 100644 --- a/src/lib/data/TaskFinishParsing.cpp +++ b/src/lib/data/TaskFinishParsing.cpp @@ -1,15 +1,13 @@ #include "TaskFinishParsing.h" +#include "Blackboard.h" #include "DialogView.h" -#include "PersistentStorage.h" #include "MessageIndexingFinished.h" #include "MessageIndexingStatus.h" -#include "MessageQuitApplication.h" #include "MessageStatus.h" -#include "Blackboard.h" -#include "utility.h" +#include "PersistentStorage.h" +#include "TimeStamp.h" #include "utilityString.h" -#include "Application.h" TaskFinishParsing::TaskFinishParsing(std::shared_ptr storage, std::shared_ptr dialogView) : m_storage(storage) @@ -32,13 +30,13 @@ void TaskFinishParsing::doEnter(std::shared_ptr blackboard) Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr blackboard) { - TimeStamp start = utility::durationStart(); + TimeStamp start = TimeStamp::now(); m_dialogView->showUnknownProgressDialog(L"Finish Indexing", L"Optimizing database"); m_storage->optimizeMemory(); m_dialogView->hideUnknownProgressDialog(); - float time = utility::duration(start); + float time = TimeStamp::durationSeconds(start); if (blackboard->exists("clear_time")) { @@ -68,7 +66,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr blackboa std::wstring status; status += L"Finished indexing: "; status += std::to_wstring(indexedSourceFileCount) + L"/" + std::to_wstring(sourceFileCount) + L" source files indexed; "; - status += utility::decodeFromUtf8(utility::timeToString(time)); + status += utility::decodeFromUtf8(TimeStamp::secondsToString(time)); status += L"; " + std::to_wstring(errorInfo.total) + L" error" + (errorInfo.total != 1 ? L"s" : L""); if (errorInfo.fatal > 0) { diff --git a/src/lib/data/indexer/CombinedIndexerCommandProvider.cpp b/src/lib/data/indexer/CombinedIndexerCommandProvider.cpp index 06f41680..fd6ae971 100644 --- a/src/lib/data/indexer/CombinedIndexerCommandProvider.cpp +++ b/src/lib/data/indexer/CombinedIndexerCommandProvider.cpp @@ -1,5 +1,6 @@ #include "CombinedIndexerCommandProvider.h" +#include "logging.h" #include "utility.h" void CombinedIndexerCommandProvider::addProvider(std::shared_ptr provider) diff --git a/src/lib/data/indexer/CombinedIndexerCommandProvider.h b/src/lib/data/indexer/CombinedIndexerCommandProvider.h index 00010723..353eec34 100644 --- a/src/lib/data/indexer/CombinedIndexerCommandProvider.h +++ b/src/lib/data/indexer/CombinedIndexerCommandProvider.h @@ -5,14 +5,17 @@ #include "IndexerCommandProvider.h" -class CombinedIndexerCommandProvider : public IndexerCommandProvider +class CombinedIndexerCommandProvider + : public IndexerCommandProvider { public: void addProvider(std::shared_ptr provider); + std::vector getAllSourceFilePaths() const override; std::shared_ptr consumeCommand() override; std::shared_ptr consumeCommandForSourceFilePath(const FilePath& filePath) override; std::vector> consumeAllCommands() override; + void clear() override; size_t size() const override; diff --git a/src/lib/data/indexer/TaskExecuteCustomCommands.cpp b/src/lib/data/indexer/TaskExecuteCustomCommands.cpp index d4c68037..5e120f98 100644 --- a/src/lib/data/indexer/TaskExecuteCustomCommands.cpp +++ b/src/lib/data/indexer/TaskExecuteCustomCommands.cpp @@ -39,7 +39,7 @@ TaskExecuteCustomCommands::TaskExecuteCustomCommands( void TaskExecuteCustomCommands::doEnter(std::shared_ptr blackboard) { m_dialogView->hideUnknownProgressDialog(); - m_start = utility::durationStart(); + m_start = TimeStamp::now(); if (m_indexerCommandProvider) { @@ -134,7 +134,7 @@ Task::TaskState TaskExecuteCustomCommands::doUpdate(std::shared_ptr void TaskExecuteCustomCommands::doExit(std::shared_ptr blackboard) { m_storage.reset(); - const float duration = utility::duration(m_start); + const float duration = TimeStamp::durationSeconds(m_start); blackboard->update("index_time", [duration](float currentDuration) { return currentDuration + duration; }); } diff --git a/src/lib/data/parser/ParseLocation.cpp b/src/lib/data/parser/ParseLocation.cpp index b4cd7ab9..656ec7fe 100644 --- a/src/lib/data/parser/ParseLocation.cpp +++ b/src/lib/data/parser/ParseLocation.cpp @@ -11,8 +11,8 @@ ParseLocation::ParseLocation() ParseLocation::ParseLocation( Id fileId, - uint lineNumber, - uint columnNumber + size_t lineNumber, + size_t columnNumber ) : fileId(fileId) , startLineNumber(lineNumber) @@ -24,8 +24,8 @@ ParseLocation::ParseLocation( ParseLocation::ParseLocation( Id fileId, - uint startLineNumber, uint startColumnNumber, - uint endLineNumber, uint endColumnNumber + size_t startLineNumber, size_t startColumnNumber, + size_t endLineNumber, size_t endColumnNumber ) : fileId(fileId) , startLineNumber(startLineNumber) diff --git a/src/lib/data/parser/ParseLocation.h b/src/lib/data/parser/ParseLocation.h index 3cfdb164..0b069896 100644 --- a/src/lib/data/parser/ParseLocation.h +++ b/src/lib/data/parser/ParseLocation.h @@ -20,22 +20,22 @@ struct ParseLocation ParseLocation(); ParseLocation( Id fileId, - uint lineNumber, - uint columnNumber + size_t lineNumber, + size_t columnNumber ); ParseLocation( Id fileId, - uint startLineNumber, uint startColumnNumber, - uint endLineNumber, uint endColumnNumber + size_t startLineNumber, size_t startColumnNumber, + size_t endLineNumber, size_t endColumnNumber ); bool isValid() const; Id fileId; - uint startLineNumber; - uint startColumnNumber; - uint endLineNumber; - uint endColumnNumber; + size_t startLineNumber; + size_t startColumnNumber; + size_t endLineNumber; + size_t endColumnNumber; }; #endif // PARSE_LOCATION_H diff --git a/src/lib/data/parser/TaskParseWrapper.cpp b/src/lib/data/parser/TaskParseWrapper.cpp index 20a3b9c0..0fb749f5 100644 --- a/src/lib/data/parser/TaskParseWrapper.cpp +++ b/src/lib/data/parser/TaskParseWrapper.cpp @@ -3,7 +3,6 @@ #include "DialogView.h" #include "PersistentStorage.h" #include "Blackboard.h" -#include "utility.h" TaskParseWrapper::TaskParseWrapper(std::weak_ptr storage, std::shared_ptr dialogView) : m_storage(storage) @@ -19,7 +18,7 @@ void TaskParseWrapper::doEnter(std::shared_ptr blackboard) m_dialogView->clearDialogs(); m_dialogView->updateIndexingDialog(0, 0, sourceFileCount, { }); - m_start = utility::durationStart(); + m_start = TimeStamp::now(); if (sourceFileCount > 0) { @@ -37,7 +36,7 @@ Task::TaskState TaskParseWrapper::doUpdate(std::shared_ptr blackboar void TaskParseWrapper::doExit(std::shared_ptr blackboard) { - float duration = utility::duration(m_start); + float duration = TimeStamp::durationSeconds(m_start); blackboard->update("index_time", [duration](float currentDuration) { return currentDuration + duration; }); } diff --git a/src/lib/data/access/StorageAccess.h b/src/lib/data/storage/StorageAccess.h similarity index 100% rename from src/lib/data/access/StorageAccess.h rename to src/lib/data/storage/StorageAccess.h diff --git a/src/lib/data/access/StorageAccessProxy.cpp b/src/lib/data/storage/StorageAccessProxy.cpp similarity index 100% rename from src/lib/data/access/StorageAccessProxy.cpp rename to src/lib/data/storage/StorageAccessProxy.cpp diff --git a/src/lib/data/access/StorageAccessProxy.h b/src/lib/data/storage/StorageAccessProxy.h similarity index 100% rename from src/lib/data/access/StorageAccessProxy.h rename to src/lib/data/storage/StorageAccessProxy.h diff --git a/src/lib/data/storage/type/StorageSourceLocation.h b/src/lib/data/storage/type/StorageSourceLocation.h index a791d3ca..7f4db9a9 100644 --- a/src/lib/data/storage/type/StorageSourceLocation.h +++ b/src/lib/data/storage/type/StorageSourceLocation.h @@ -14,7 +14,7 @@ struct StorageSourceLocationData , type(0) {} - StorageSourceLocationData(Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type) + StorageSourceLocationData(Id fileNodeId, size_t startLine, size_t startCol, size_t endLine, size_t endCol, int type) : fileNodeId(fileNodeId) , startLine(startLine) , startCol(startCol) @@ -52,10 +52,10 @@ struct StorageSourceLocationData } Id fileNodeId; - uint startLine; - uint startCol; - uint endLine; - uint endCol; + size_t startLine; + size_t startCol; + size_t endLine; + size_t endCol; int type; }; @@ -71,7 +71,7 @@ struct StorageSourceLocation: public StorageSourceLocationData , id(id) {} - StorageSourceLocation(Id id, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type) + StorageSourceLocation(Id id, Id fileNodeId, size_t startLine, size_t startCol, size_t endLine, size_t endCol, int type) : StorageSourceLocationData(fileNodeId, startLine, startCol, endLine, endCol, type) , id(id) {} diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index 9b7879e8..4855b1c1 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -131,10 +131,10 @@ void Project::load(std::shared_ptr dialogView) if (dbPath.exists()) { if (dialogView->confirm( - "Sourcetrail has been closed unexpectedly while indexing this project. You can either choose to keep " - "the data that has already been indexed or discard that data and restore the state of your project " - "before indexing?", - { "Keep and Continue", "Discard and Restore" }) == 0) + L"Sourcetrail has been closed unexpectedly while indexing this project. You can either choose to keep " + L"the data that has already been indexed or discard that data and restore the state of your project " + L"before indexing?", + { L"Keep and Continue", L"Discard and Restore" }) == 0) { LOG_INFO("Switching to temporary indexing data on user's decision"); if (!swapToTempStorageFile(dbPath, tempDbPath, dialogView)) @@ -261,7 +261,7 @@ void Project::refresh(RefreshMode refreshMode, std::shared_ptr dialo bool needsFullRefresh = false; bool fullRefresh = false; - std::string question; + std::wstring question; switch (m_state) { @@ -274,31 +274,31 @@ void Project::refresh(RefreshMode refreshMode, std::shared_ptr dialo case PROJECT_STATE_OUTDATED: question = - "The project file was changed after the last indexing. The project needs to get fully reindexed to " - "reflect the current project state. Alternatively you can also choose to just reindex updated or " - "incomplete files. Do you want to reindex the project?"; + L"The project file was changed after the last indexing. The project needs to get fully reindexed to " + L"reflect the current project state. Alternatively you can also choose to just reindex updated or " + L"incomplete files. Do you want to reindex the project?"; fullRefresh = true; break; case PROJECT_STATE_OUTVERSIONED: question = - "This project was indexed with a different version of Sourcetrail. It needs to be fully reindexed to " - "be used with this version of Sourcetrail. Do you want to reindex the project?"; + L"This project was indexed with a different version of Sourcetrail. It needs to be fully reindexed to " + L"be used with this version of Sourcetrail. Do you want to reindex the project?"; needsFullRefresh = true; break; case PROJECT_STATE_NEEDS_MIGRATION: question = - "This project was created with a different version and uses an old project file format. " - "The project can still be opened and used with this version, but needs to be fully reindexed. " - "Do you want Sourcetrail to update the project file and reindex the project?"; + L"This project was created with a different version and uses an old project file format. " + L"The project can still be opened and used with this version, but needs to be fully reindexed. " + L"Do you want Sourcetrail to update the project file and reindex the project?"; needsFullRefresh = true; break; case PROJECT_STATE_DB_CORRUPTED: question = - "There was a problem loading the index of this project. The project needs to get fully reindexed. " - "Do you want to reindex the project?"; + L"There was a problem loading the index of this project. The project needs to get fully reindexed. " + L"Do you want to reindex the project?"; needsFullRefresh = true; break; @@ -308,7 +308,7 @@ void Project::refresh(RefreshMode refreshMode, std::shared_ptr dialo if (question.size() && m_hasGUI) { - if (dialogView->confirm(question, { "Reindex", "Cancel" }) == 1) + if (dialogView->confirm(question, { L"Reindex", L"Cancel" }) == 1) { return; } @@ -318,9 +318,9 @@ void Project::refresh(RefreshMode refreshMode, std::shared_ptr dialo ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled() && m_hasGUI) { if (dialogView->confirm( - "Warning: You are about to index your project with the \"verbose indexer logging\" setting " - "enabled. This will cause a significant slowdown in indexing performance. Do you want to proceed?", - { "Yes", "No" }) == 1) + L"Warning: You are about to index your project with the \"verbose indexer logging\" setting " + L"enabled. This will cause a significant slowdown in indexing performance. Do you want to proceed?", + { L"Yes", L"No" }) == 1) { return; } @@ -440,9 +440,10 @@ void Project::buildIndex(RefreshInfo info, std::shared_ptr dialogVie if (abortIndexing) { if (m_hasGUI && dialogView->confirm( - "

This project contains a source group of type \"" + sourceGroupTypeToString(sourceGroup->getType()) + "\" " - "that cannot be partially cleared. Do you want to re-index the whole project instead?

", - { "Full Re-Index", "Cancel" } + L"

This project contains a source group of type \"" + + utility::decodeFromUtf8(sourceGroupTypeToString(sourceGroup->getType())) + + L"\" that cannot be partially cleared. Do you want to re-index the whole project instead?

", + { L"Full Re-Index", L"Cancel" } ) == 1) { MessageStatus(L"Cannot partially clear project. Indexing aborted.").dispatch(); @@ -715,9 +716,9 @@ bool Project::swapToTempStorageFile(const FilePath& indexDbFilePath, const FileP if (m_hasGUI) { dialogView->confirm( - "

The old index database file of this project seems to be used by a different process and cannot " - "be updated.

Please close all processes that are using this database and re-load this project to " - "apply or discard the changes pending from the current indexer run.

" + L"

The old index database file of this project seems to be used by a different process and cannot " + L"be updated.

Please close all processes that are using this database and re-load this project to " + L"apply or discard the changes pending from the current indexer run.

" ); } return false; diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index a7d2a1d9..66c617e1 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -1,11 +1,12 @@ #include "ApplicationSettings.h" +#include "AppPath.h" #include "License.h" +#include "Logger.h" +#include "ResourcePaths.h" #include "SettingsMigrator.h" #include "SettingsMigrationLambda.h" #include "SettingsMigrationMoveKey.h" -#include "AppPath.h" -#include "ResourcePaths.h" #include "Status.h" #include "TimeStamp.h" #include "UserPaths.h" diff --git a/src/lib/utility/TimeStamp.cpp b/src/lib/utility/TimeStamp.cpp index 7699dd1c..6762228b 100644 --- a/src/lib/utility/TimeStamp.cpp +++ b/src/lib/utility/TimeStamp.cpp @@ -5,6 +5,45 @@ TimeStamp TimeStamp::now() return TimeStamp(boost::posix_time::microsec_clock::local_time()); } +double TimeStamp::durationSeconds(const TimeStamp& start) +{ + return double(TimeStamp::now().deltaMS(start)) / 1000.0; +} + +std::string TimeStamp::secondsToString(double secs) +{ + std::stringstream ss; + + int hours = int(secs / 3600); + secs -= hours * 3600; + + int minutes = int(secs / 60); + secs -= minutes * 60; + + int seconds = int(secs); + secs -= seconds; + + int milliSeconds = secs * 1000; + + if (hours > 9) + { + ss << hours; + } + else + { + ss << std::setw(2) << std::setfill('0') << hours; + } + ss << ":" << std::setw(2) << std::setfill('0') << minutes; + ss << ":" << std::setw(2) << std::setfill('0') << seconds; + + if (!hours && !minutes) + { + ss << ":" << std::setw(3) << std::setfill('0') << milliSeconds; + } + + return ss.str(); +} + TimeStamp::TimeStamp() : m_time(boost::posix_time::not_a_date_time) { diff --git a/src/lib/utility/TimeStamp.h b/src/lib/utility/TimeStamp.h index 49f8bed1..7d304cb0 100644 --- a/src/lib/utility/TimeStamp.h +++ b/src/lib/utility/TimeStamp.h @@ -8,6 +8,9 @@ class TimeStamp public: static TimeStamp now(); + static double durationSeconds(const TimeStamp& start); + static std::string secondsToString(double seconds); + TimeStamp(); TimeStamp(boost::posix_time::ptime t); TimeStamp(std::string s); diff --git a/src/lib/utility/commandline/commands/CommandlineCommandConfig.cpp b/src/lib/utility/commandline/commands/CommandlineCommandConfig.cpp index a6bbb5a4..702f96a7 100644 --- a/src/lib/utility/commandline/commands/CommandlineCommandConfig.cpp +++ b/src/lib/utility/commandline/commands/CommandlineCommandConfig.cpp @@ -1,13 +1,14 @@ #include "CommandlineCommandConfig.h" #include +#include #include +#include "ApplicationSettings.h" #include "CommandlineHelper.h" #include "CommandLineParser.h" #include "FilePath.h" - -#include "ApplicationSettings.h" +#include "logging.h" namespace commandline { diff --git a/src/lib/utility/commandline/commands/CommandlineCommandIndex.cpp b/src/lib/utility/commandline/commands/CommandlineCommandIndex.cpp index 426a6429..c2b217e1 100644 --- a/src/lib/utility/commandline/commands/CommandlineCommandIndex.cpp +++ b/src/lib/utility/commandline/commands/CommandlineCommandIndex.cpp @@ -1,5 +1,7 @@ #include "CommandlineCommandIndex.h" +#include + #include "CommandlineHelper.h" #include "CommandLineParser.h" diff --git a/src/lib/utility/utilityFile.cpp b/src/lib/utility/file/utilityFile.cpp similarity index 99% rename from src/lib/utility/utilityFile.cpp rename to src/lib/utility/file/utilityFile.cpp index a9657bee..0098d3d9 100644 --- a/src/lib/utility/utilityFile.cpp +++ b/src/lib/utility/file/utilityFile.cpp @@ -3,6 +3,7 @@ #include "FilePath.h" #include "FileSystem.h" +#include "logging.h" #include "utility.h" std::vector utility::partitionFilePathsBySize(std::vector filePaths, int partitionCount) diff --git a/src/lib/utility/utilityFile.h b/src/lib/utility/file/utilityFile.h similarity index 99% rename from src/lib/utility/utilityFile.h rename to src/lib/utility/file/utilityFile.h index 98bcbe8e..f867aa4e 100644 --- a/src/lib/utility/utilityFile.h +++ b/src/lib/utility/file/utilityFile.h @@ -16,6 +16,7 @@ namespace utility FilePath getExpandedPath(const FilePath& path); std::vector getExpandedPaths(const std::vector& paths); FilePath getExpandedAndAbsolutePath(const FilePath& path, const FilePath& baseDirectory); + FilePath getAsRelativeIfShorter(const FilePath& absolutePath, const FilePath& baseDirectory); std::vector getAsRelativeIfShorter(const std::vector& absolutePaths, const FilePath& baseDirectory); } diff --git a/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp b/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp index 2281c2c0..f7b40a3f 100644 --- a/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp +++ b/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp @@ -4,7 +4,7 @@ #include "logging.h" #include "TimeStamp.h" -#include "utility.h" +#include "utilityApp.h" std::string SharedMemoryGarbageCollector::s_memoryNamePrefix = "grbg_cllctr_"; std::string SharedMemoryGarbageCollector::s_instancesKeyName = "running_instances"; diff --git a/src/lib/utility/logging/LogManager.cpp b/src/lib/utility/logging/LogManager.cpp index f9a5513d..479701cc 100644 --- a/src/lib/utility/logging/LogManager.cpp +++ b/src/lib/utility/logging/LogManager.cpp @@ -4,9 +4,9 @@ #include "logging.h" #include "MessageStatus.h" -#include "utility.h" -#include "Version.h" +#include "utilityApp.h" #include "utilityString.h" +#include "Version.h" std::shared_ptr LogManager::getInstance() { diff --git a/src/lib/utility/sonargraph/SonargraphXsdCppManualModule.cpp b/src/lib/utility/sonargraph/SonargraphXsdCppManualModule.cpp index 5d349186..d444ae99 100644 --- a/src/lib/utility/sonargraph/SonargraphXsdCppManualModule.cpp +++ b/src/lib/utility/sonargraph/SonargraphXsdCppManualModule.cpp @@ -2,14 +2,15 @@ #include "tinyxml.h" -#include "IndexerCommandCxx.h" #include "ApplicationSettings.h" -#include "SourceGroupSettingsCxxSonargraph.h" +#include "IndexerCommandCxx.h" #include "FileSystem.h" +#include "logging.h" #include "SonargraphSoftwareSystem.h" -#include "utilitySonargraph.h" +#include "SourceGroupSettingsCxxSonargraph.h" #include "utility.h" #include "utilityFile.h" +#include "utilitySonargraph.h" #include "utilityXml.h" namespace Sonargraph diff --git a/src/lib/utility/sonargraph/SonargraphXsdJavaModule.cpp b/src/lib/utility/sonargraph/SonargraphXsdJavaModule.cpp index 65ad3540..58547f40 100644 --- a/src/lib/utility/sonargraph/SonargraphXsdJavaModule.cpp +++ b/src/lib/utility/sonargraph/SonargraphXsdJavaModule.cpp @@ -2,16 +2,17 @@ #include "tinyxml.h" +#include "FileSystem.h" #include "IndexerCommandJava.h" #include "LanguageType.h" -#include "SourceGroupSettingsJavaSonargraph.h" -#include "FileSystem.h" -#include "SonargraphSoftwareSystem.h" +#include "logging.h" #include "SonargraphSourceRootPath.h" +#include "SonargraphSoftwareSystem.h" #include "SonargraphXsdRootPath.h" -#include "utilitySonargraph.h" +#include "SourceGroupSettingsJavaSonargraph.h" #include "utility.h" #include "utilityFile.h" +#include "utilitySonargraph.h" #include "utilityXml.h" namespace Sonargraph diff --git a/src/lib/utility/tracing.h b/src/lib/utility/tracing.h index 5801d424..d9d5cd74 100644 --- a/src/lib/utility/tracing.h +++ b/src/lib/utility/tracing.h @@ -10,9 +10,10 @@ #include #include +#include "FilePath.h" #include "TimeStamp.h" #include "types.h" -#include "utility.h" +#include "utilityString.h" struct TraceEvent { @@ -21,7 +22,7 @@ public: : eventName("") , id(0) , depth(0) - , time(0.0f) + , time(0.0) { } @@ -29,7 +30,7 @@ public: : eventName(eventName) , id(id) , depth(depth) - , time(0.0f) + , time(0.0) { } @@ -40,7 +41,7 @@ public: std::string functionName; std::string locationName; - float time; + double time; }; @@ -84,7 +85,7 @@ private: { TraceEvent event; size_t count; - float time; + double time; }; static std::shared_ptr s_instance; @@ -121,13 +122,13 @@ ScopedTrace::ScopedTrace( m_event->functionName = functionName; m_event->locationName = utility::encodeToUtf8(FilePath(fileName).fileName()) + ":" + std::to_string(lineNumber); - m_timeStamp = utility::durationStart(); + m_timeStamp = TimeStamp::now(); } template ScopedTrace::~ScopedTrace() { - m_event->time = utility::duration(m_timeStamp); + m_event->time = TimeStamp::durationSeconds(m_timeStamp); TracerType::getInstance()->finishEvent(m_event); } diff --git a/src/lib/utility/types.h b/src/lib/utility/types.h index 754161c2..2855e4a6 100644 --- a/src/lib/utility/types.h +++ b/src/lib/utility/types.h @@ -5,6 +5,4 @@ typedef size_t Id; -typedef unsigned int uint; - #endif // TYPES_H diff --git a/src/lib/utility/utility.cpp b/src/lib/utility/utility.cpp index ea03fb7b..3741abaa 100644 --- a/src/lib/utility/utility.cpp +++ b/src/lib/utility/utility.cpp @@ -1,107 +1,5 @@ #include "utility.h" -#include -#include - -#include - - -ApplicationArchitectureType utility::getApplicationArchitectureType() -{ -#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) || defined(WIN64) - return APPLICATION_ARCHITECTURE_X86_64; -#else - return APPLICATION_ARCHITECTURE_X86_32; -#endif - return APPLICATION_ARCHITECTURE_UNKNOWN; -} - -TimeStamp utility::durationStart() -{ - return TimeStamp::now(); -} - -float utility::duration(const TimeStamp& start) -{ - TimeStamp now = durationStart(); - return float(now.deltaMS(start)) / 1000.0f; -} - -float utility::duration(std::function func) -{ - const TimeStamp start = durationStart(); - - func(); - - return duration(start); -} - -std::string utility::timeToString(const time_t time) -{ - char buff[20]; - strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&time)); - return std::string(buff); -} - -std::string utility::timeToString(const boost::posix_time::ptime time) -{ - return TimeStamp(time).toString(); -} - -std::string utility::timeToString(float secondsTotal) -{ - std::stringstream ss; - - int hours = int(secondsTotal / 3600); - secondsTotal -= hours * 3600; - int minutes = int(secondsTotal / 60); - secondsTotal -= minutes * 60; - int seconds = int(secondsTotal); - secondsTotal -= seconds; - int milliSeconds = secondsTotal * 1000; - - if (hours > 9) - { - ss << hours; - } - else - { - ss << std::setw(2) << std::setfill('0') << hours; - } - ss << ":" << std::setw(2) << std::setfill('0') << minutes; - ss << ":" << std::setw(2) << std::setfill('0') << seconds; - - if (!hours && !minutes) - { - ss << ":" << std::setw(3) << std::setfill('0') << milliSeconds; - } - - return ss.str(); -} - -bool utility::intersectionPoint(Vec2f a1, Vec2f b1, Vec2f a2, Vec2f b2, Vec2f* i) -{ - Vec2f p = a1; - Vec2f v = b1 - a1; - Vec2f q = a2; - Vec2f w = b2 - a2; - - float denominator = v.x * w.y - v.y * w.x; - if (denominator != 0) - { - float t = (p.y * w.x - p.x * w.y + q.x * w.y - q.y * w.x) / denominator; - float s = (q.y * v.x - q.x * v.y + p.x * v.y - p.y * v.x) / -denominator; - - if (t >= 0 && t <= 1 && s >= 0 && s <= 1) - { - *i = p + v * t; - return true; - } - } - - return false; -} - size_t utility::digits(size_t n) { int digits = 1; @@ -114,8 +12,3 @@ size_t utility::digits(size_t n) return digits; } - -int utility::roundToInt(float n) -{ - return (n > 0.0f) ? (n + 0.5f) : (n - 0.5f); -} diff --git a/src/lib/utility/utility.h b/src/lib/utility/utility.h index dec87f99..a941505c 100644 --- a/src/lib/utility/utility.h +++ b/src/lib/utility/utility.h @@ -5,29 +5,16 @@ #include #include #include +#include #include -#include #include #include -#include - -#include "ApplicationArchitectureType.h" #include "FilePath.h" -#include "Vector2.h" -#include "TimeStamp.h" #include "utilityString.h" namespace utility { - TimeStamp durationStart(); - float duration(const TimeStamp& start); - float duration(std::function func); - - std::string timeToString(const time_t time); - std::string timeToString(const boost::posix_time::ptime time); - std::string timeToString(float seconds); - template std::vector> splitToEqualySizedParts(const std::vector& values, const size_t desiredPartCount); @@ -74,13 +61,15 @@ namespace utility std::vector createVectorFromElements(const Args&... args); template - std::vector convert(const std::vector& sourceContainer, std::function conversion); + std::vector convert( + const std::vector& sourceContainer, std::function conversion); template std::vector convert(const std::vector& sourceContainer); template - std::set convert(const std::set& sourceContainer, std::function conversion); + std::set convert( + const std::set& sourceContainer, std::function conversion); template std::set convert(const std::set& sourceContainer); @@ -134,13 +123,7 @@ namespace utility return false; } - ApplicationArchitectureType getApplicationArchitectureType(); - - bool intersectionPoint(Vec2f a1, Vec2f b1, Vec2f a2, Vec2f b2, Vec2f* i); - size_t digits(size_t n); - - int roundToInt(float n); } template @@ -286,7 +269,8 @@ std::vector utility::createVectorFromElements(const Args&... args) } template -std::vector utility::convert(const std::vector& sourceContainer, std::function conversion) +std::vector utility::convert( + const std::vector& sourceContainer, std::function conversion) { std::vector targetContainer; targetContainer.reserve(sourceContainer.size()); @@ -310,7 +294,8 @@ std::vector utility::convert(const std::vector& sourceCo } template -std::set utility::convert(const std::set& sourceContainer, std::function conversion) +std::set utility::convert( + const std::set& sourceContainer, std::function conversion) { std::set targetContainer; for (const SourceType& sourceElement : sourceContainer) diff --git a/src/lib/utility/utilityMath.cpp b/src/lib/utility/utilityMath.cpp deleted file mode 100644 index 0823289c..00000000 --- a/src/lib/utility/utilityMath.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "utilityMath.h" - -unsigned long int utility::getPowerOfTwo(unsigned int exponent) -{ - static const long int powerOfTwos[] = - { - 1 << 0, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7, - 1 << 8, 1 << 9, 1 << 10, 1 << 11, 1 << 12, 1 << 13, 1 << 14, 1 << 15, - 1 << 16, 1 << 17, 1 << 18, 1 << 19, 1 << 20, 1 << 21, 1 << 22, 1 << 23, - 1 << 24, 1 << 25, 1 << 26, 1 << 27, 1 << 28, 1 << 29, 1 << 30, 1 << 31 - }; - return powerOfTwos[exponent]; -} diff --git a/src/lib/utility/utilityMath.h b/src/lib/utility/utilityMath.h deleted file mode 100644 index 1f8ebb4b..00000000 --- a/src/lib/utility/utilityMath.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef UTILITY_MATH_H -#define UTILITY_MATH_H - -namespace utility -{ - unsigned long int getPowerOfTwo(unsigned int exponent); -} - -#endif // UTILITY_MATH_H diff --git a/src/lib/utility/utilityUuid.cpp b/src/lib/utility/utilityUuid.cpp index b83d49e5..42553aca 100644 --- a/src/lib/utility/utilityUuid.cpp +++ b/src/lib/utility/utilityUuid.cpp @@ -1,20 +1,24 @@ #include "utilityUuid.h" #include +#include #include #include -boost::uuids::uuid utility::getUuid() +namespace utility { - return boost::uuids::random_generator()(); -} + boost::uuids::uuid getUuid() + { + return boost::uuids::random_generator()(); + } -std::string utility::uuidToString(const boost::uuids::uuid& uuid) -{ - return boost::lexical_cast(uuid); -} + std::string uuidToString(const boost::uuids::uuid& uuid) + { + return boost::lexical_cast(uuid); + } -std::string utility::getUuidString() -{ - return utility::uuidToString(utility::getUuid()); + std::string getUuidString() + { + return utility::uuidToString(utility::getUuid()); + } } diff --git a/src/lib/utility/utilityUuid.h b/src/lib/utility/utilityUuid.h index f30b4dcd..d4ccd83b 100644 --- a/src/lib/utility/utilityUuid.h +++ b/src/lib/utility/utilityUuid.h @@ -1,13 +1,14 @@ #ifndef UTILITY_UUID_H #define UTILITY_UUID_H -#include #include +// #include + namespace utility { - boost::uuids::uuid getUuid(); - std::string uuidToString(const boost::uuids::uuid& uuid); + // boost::uuids::uuid getUuid(); + // std::string uuidToString(const boost::uuids::uuid& uuid); std::string getUuidString(); } diff --git a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp index 7a4ce71b..699a1969 100644 --- a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp @@ -65,8 +65,8 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev Id fileId = 0; FilePath filePath; - uint lineNumber = 0; - uint columnNumber = 0; + size_t lineNumber = 0; + size_t columnNumber = 0; if (info.getLocation().isValid() && info.hasSourceManager()) { const clang::SourceManager& sourceManager = info.getSourceManager(); diff --git a/src/lib_cxx/project/SourceGroupCxxCdb.cpp b/src/lib_cxx/project/SourceGroupCxxCdb.cpp index 75b615f8..41e4bbbb 100644 --- a/src/lib_cxx/project/SourceGroupCxxCdb.cpp +++ b/src/lib_cxx/project/SourceGroupCxxCdb.cpp @@ -2,13 +2,15 @@ #include #include + +#include "Application.h" +#include "ApplicationSettings.h" #include "CxxIndexerCommandProvider.h" #include "IndexerCommandCxx.h" -#include "SourceGroupSettingsCxxCdb.h" -#include "ApplicationSettings.h" +#include "logging.h" #include "MessageStatus.h" +#include "SourceGroupSettingsCxxCdb.h" #include "utility.h" -#include "Application.h" SourceGroupCxxCdb::SourceGroupCxxCdb(std::shared_ptr settings) : m_settings(settings) diff --git a/src/lib_cxx/project/SourceGroupCxxEmpty.cpp b/src/lib_cxx/project/SourceGroupCxxEmpty.cpp index 5df6eba0..93b341b1 100644 --- a/src/lib_cxx/project/SourceGroupCxxEmpty.cpp +++ b/src/lib_cxx/project/SourceGroupCxxEmpty.cpp @@ -9,6 +9,7 @@ #include "FileSystem.h" #include "GeneratePCHAction.h" #include "IndexerCommandCxx.h" +#include "logging.h" #include "SingleFrontendActionFactory.h" #include "SourceGroupSettingsCEmpty.h" #include "SourceGroupSettingsCppEmpty.h" diff --git a/src/lib_cxx/utility/CompilationDatabase.cpp b/src/lib_cxx/utility/CompilationDatabase.cpp index 12741cd2..39627dbe 100644 --- a/src/lib_cxx/utility/CompilationDatabase.cpp +++ b/src/lib_cxx/utility/CompilationDatabase.cpp @@ -4,9 +4,11 @@ #include #include + #include "FilePath.h" -#include "utilityString.h" +#include "logging.h" #include "utility.h" +#include "utilityString.h" utility::CompilationDatabase::CompilationDatabase(const FilePath& filePath) : m_filePath(filePath) diff --git a/src/lib_gui/qt/element/code/QtCodeArea.cpp b/src/lib_gui/qt/element/code/QtCodeArea.cpp index 24d6e8ab..5360816d 100644 --- a/src/lib_gui/qt/element/code/QtCodeArea.cpp +++ b/src/lib_gui/qt/element/code/QtCodeArea.cpp @@ -75,7 +75,7 @@ void QtLineNumberArea::paintEvent(QPaintEvent *event) QtCodeArea::QtCodeArea( - uint startLineNumber, + size_t startLineNumber, const std::string& code, std::shared_ptr locationFile, QtCodeNavigator* navigator, @@ -319,7 +319,7 @@ void QtCodeArea::setIsActiveFile(bool isActiveFile) m_isActiveFile = isActiveFile; } -uint QtCodeArea::getLineNumberForLocationId(Id locationId) const +size_t QtCodeArea::getLineNumberForLocationId(Id locationId) const { for (const Annotation& annotation : m_annotations) { @@ -332,17 +332,17 @@ uint QtCodeArea::getLineNumberForLocationId(Id locationId) const return 0; } -std::pair QtCodeArea::getLineNumbersForLocationId(Id locationId) const +std::pair QtCodeArea::getLineNumbersForLocationId(Id locationId) const { for (const Annotation& annotation : m_annotations) { if (annotation.locationId == locationId) { - return std::pair(annotation.startLine, annotation.endLine); + return std::pair(annotation.startLine, annotation.endLine); } } - return std::pair(0, 0); + return std::pair(0, 0); } Id QtCodeArea::getLocationIdOfFirstActiveLocation(Id tokenId) const @@ -403,7 +403,7 @@ std::vector QtCodeArea::getLocationIdsForTokenIds(const std::set& tokenI size_t QtCodeArea::getActiveLocationCount() const { - uint count = 0; + size_t count = 0; for (const Annotation& annotation : m_annotations) { @@ -428,7 +428,7 @@ size_t QtCodeArea::getActiveLocationCount() const return count; } -QRectF QtCodeArea::getLineRectForLineNumber(uint lineNumber) const +QRectF QtCodeArea::getLineRectForLineNumber(size_t lineNumber) const { if (lineNumber < getStartLineNumber()) { @@ -680,7 +680,7 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event) QScrollBar* scrollbar = horizontalScrollBar(); int visibleContentWidth = width() - lineNumberAreaWidth(); float deltaPosRatio = float(deltaX) / (visibleContentWidth); - scrollbar->setValue(scrollbar->value() - utility::roundToInt(deltaPosRatio * scrollbar->pageStep())); + scrollbar->setValue(scrollbar->value() - std::round(deltaPosRatio * scrollbar->pageStep())); } std::vector annotations = getInteractiveAnnotationsForPosition(event->pos()); diff --git a/src/lib_gui/qt/element/code/QtCodeArea.h b/src/lib_gui/qt/element/code/QtCodeArea.h index 2b58e207..4e458894 100644 --- a/src/lib_gui/qt/element/code/QtCodeArea.h +++ b/src/lib_gui/qt/element/code/QtCodeArea.h @@ -53,7 +53,7 @@ class QtCodeArea public: QtCodeArea( - uint startLineNumber, + size_t startLineNumber, const std::string& code, std::shared_ptr locationFile, QtCodeNavigator* navigator, @@ -74,8 +74,8 @@ public: void setIsActiveFile(bool isActiveFile); - uint getLineNumberForLocationId(Id locationId) const; - std::pair getLineNumbersForLocationId(Id locationId) const; + size_t getLineNumberForLocationId(Id locationId) const; + std::pair getLineNumbersForLocationId(Id locationId) const; Id getLocationIdOfFirstActiveLocation(Id tokenId) const; Id getLocationIdOfFirstActiveScopeLocation(Id tokenId) const; @@ -85,7 +85,7 @@ public: size_t getActiveLocationCount() const; - QRectF getLineRectForLineNumber(uint lineNumber) const; + QRectF getLineRectForLineNumber(size_t lineNumber) const; void findScreenMatches(const std::wstring& query, std::vector>* screenMatches); void clearScreenMatches(); diff --git a/src/lib_gui/qt/element/code/QtCodeField.cpp b/src/lib_gui/qt/element/code/QtCodeField.cpp index 5476c114..e7ecb619 100644 --- a/src/lib_gui/qt/element/code/QtCodeField.cpp +++ b/src/lib_gui/qt/element/code/QtCodeField.cpp @@ -28,7 +28,7 @@ void QtCodeField::clearAnnotationColors() } QtCodeField::QtCodeField( - uint startLineNumber, + size_t startLineNumber, const std::string& code, std::shared_ptr locationFile, bool convertLocationsOnDemand, @@ -128,12 +128,12 @@ QSize QtCodeField::sizeHint() const return QSize(width + 1, height + 5); } -uint QtCodeField::getStartLineNumber() const +size_t QtCodeField::getStartLineNumber() const { return m_startLineNumber; } -uint QtCodeField::getEndLineNumber() const +size_t QtCodeField::getEndLineNumber() const { return m_startLineNumber + blockCount() - 1; } @@ -382,7 +382,7 @@ void QtCodeField::createAnnotations(std::shared_ptr location m_locationFile = locationFile; m_annotations.clear(); - uint endLineNumber = getEndLineNumber(); + size_t endLineNumber = getEndLineNumber(); std::set locationIds; locationFile->forEachSourceLocation( diff --git a/src/lib_gui/qt/element/code/QtCodeField.h b/src/lib_gui/qt/element/code/QtCodeField.h index 9f12fc78..8749d498 100644 --- a/src/lib_gui/qt/element/code/QtCodeField.h +++ b/src/lib_gui/qt/element/code/QtCodeField.h @@ -22,7 +22,7 @@ public: static void clearAnnotationColors(); QtCodeField( - uint startLineNumber, + size_t startLineNumber, const std::string& code, std::shared_ptr locationFile, bool convertLocationsOnDemand = true, @@ -32,8 +32,8 @@ public: virtual QSize sizeHint() const Q_DECL_OVERRIDE; - uint getStartLineNumber() const; - uint getEndLineNumber() const; + size_t getStartLineNumber() const; + size_t getEndLineNumber() const; int totalLineHeight() const; @@ -122,7 +122,7 @@ private: void createMultibyteCharacterLocationCache(const QString& code); int getColumnCorrectedForMultibyteCharacters(int line, int column) const; - const uint m_startLineNumber; + const size_t m_startLineNumber; const std::string m_code; std::shared_ptr m_locationFile; diff --git a/src/lib_gui/qt/element/code/QtCodeFile.cpp b/src/lib_gui/qt/element/code/QtCodeFile.cpp index c3aff15a..d99af6c7 100644 --- a/src/lib_gui/qt/element/code/QtCodeFile.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFile.cpp @@ -126,8 +126,8 @@ QtCodeSnippet* QtCodeFile::insertCodeSnippet(const CodeSnippetParams& params) size_t i = 0; while (i < m_snippets.size()) { - uint start = newSnippet->getStartLineNumber(); - uint end = newSnippet->getEndLineNumber(); + size_t start = newSnippet->getStartLineNumber(); + size_t end = newSnippet->getEndLineNumber(); QtCodeSnippet* oldSnippet = m_snippets[i]; @@ -434,7 +434,7 @@ void QtCodeFile::clickedSnippetButton() void QtCodeFile::clickedMaximizeButton() { - uint lineNumber = 0; + size_t lineNumber = 0; Id locationId = 0; std::pair snippet = getFirstSnippetWithActiveLocationId(0); diff --git a/src/lib_gui/qt/element/code/QtCodeFileList.cpp b/src/lib_gui/qt/element/code/QtCodeFileList.cpp index cd86ccb5..9805187a 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileList.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFileList.cpp @@ -158,7 +158,7 @@ void QtCodeFileList::requestFileContent(const FilePath& filePath) getFile(filePath)->requestContent(); } -bool QtCodeFileList::requestScroll(const FilePath& filePath, uint lineNumber, Id locationId, bool animated, ScrollTarget target) +bool QtCodeFileList::requestScroll(const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, ScrollTarget target) { QtCodeFile* file = getFile(filePath); if (!file) @@ -199,12 +199,12 @@ bool QtCodeFileList::requestScroll(const FilePath& filePath, uint lineNumber, Id return true; } - uint endLineNumber = 0; + size_t endLineNumber = 0; if (!lineNumber) { if (locationId) { - std::pair lineNumbers = snippet->getLineNumbersForLocationId(locationId); + std::pair lineNumbers = snippet->getLineNumbersForLocationId(locationId); lineNumber = lineNumbers.first; diff --git a/src/lib_gui/qt/element/code/QtCodeFileList.h b/src/lib_gui/qt/element/code/QtCodeFileList.h index 8922659e..754d975b 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileList.h +++ b/src/lib_gui/qt/element/code/QtCodeFileList.h @@ -38,7 +38,7 @@ public: void updateCodeSnippet(const CodeSnippetParams& params) override; void requestFileContent(const FilePath& filePath) override; - bool requestScroll(const FilePath& filePath, uint lineNumber, Id locationId, bool animated, ScrollTarget target) override; + bool requestScroll(const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, ScrollTarget target) override; void updateFiles() override; void showContents() override; diff --git a/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp b/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp index b31465de..6f717348 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp +++ b/src/lib_gui/qt/element/code/QtCodeFileSingle.cpp @@ -153,7 +153,7 @@ void QtCodeFileSingle::requestFileContent(const FilePath& filePath) } bool QtCodeFileSingle::requestScroll( - const FilePath& filePath, uint lineNumber, Id locationId, bool animated, ScrollTarget target) + const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, ScrollTarget target) { FileData file = getFileData(filePath); if (file.area) @@ -171,12 +171,12 @@ bool QtCodeFileSingle::requestScroll( animated = false; } - uint endLineNumber = 0; + size_t endLineNumber = 0; if (!lineNumber) { if (locationId) { - std::pair lineNumbers = m_area->getLineNumbersForLocationId(locationId); + std::pair lineNumbers = m_area->getLineNumbersForLocationId(locationId); lineNumber = lineNumbers.first; diff --git a/src/lib_gui/qt/element/code/QtCodeFileSingle.h b/src/lib_gui/qt/element/code/QtCodeFileSingle.h index 9a8018f5..48fd55fe 100644 --- a/src/lib_gui/qt/element/code/QtCodeFileSingle.h +++ b/src/lib_gui/qt/element/code/QtCodeFileSingle.h @@ -38,7 +38,7 @@ public: void requestFileContent(const FilePath& filePath) override; bool requestScroll( - const FilePath& filePath, uint lineNumber, Id locationId, bool animated, ScrollTarget target) override; + const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, ScrollTarget target) override; void updateFiles() override; void showContents() override; diff --git a/src/lib_gui/qt/element/code/QtCodeNavigateable.h b/src/lib_gui/qt/element/code/QtCodeNavigateable.h index d3b8beef..a59908da 100644 --- a/src/lib_gui/qt/element/code/QtCodeNavigateable.h +++ b/src/lib_gui/qt/element/code/QtCodeNavigateable.h @@ -32,7 +32,7 @@ public: virtual void updateCodeSnippet(const CodeSnippetParams& params) = 0; virtual void requestFileContent(const FilePath& filePath) = 0; - virtual bool requestScroll(const FilePath& filePath, uint lineNumber, Id locationId, bool animated, ScrollTarget target) = 0; + virtual bool requestScroll(const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, ScrollTarget target) = 0; virtual void updateFiles() = 0; virtual void showContents() = 0; diff --git a/src/lib_gui/qt/element/code/QtCodeNavigator.cpp b/src/lib_gui/qt/element/code/QtCodeNavigator.cpp index 0a335243..79736f6f 100644 --- a/src/lib_gui/qt/element/code/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/code/QtCodeNavigator.cpp @@ -838,7 +838,7 @@ void QtCodeNavigator::scrollToSnippetIfRequested() } void QtCodeNavigator::requestScroll( - const FilePath& filePath, uint lineNumber, Id locationId, bool animated, QtCodeNavigateable::ScrollTarget target) + const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, QtCodeNavigateable::ScrollTarget target) { ScrollRequest req; req.filePath = filePath; diff --git a/src/lib_gui/qt/element/code/QtCodeNavigator.h b/src/lib_gui/qt/element/code/QtCodeNavigator.h index ff1d594b..0768cbcd 100644 --- a/src/lib_gui/qt/element/code/QtCodeNavigator.h +++ b/src/lib_gui/qt/element/code/QtCodeNavigator.h @@ -114,7 +114,7 @@ public: void scrollToSnippetIfRequested(); void requestScroll( - const FilePath& filePath, uint lineNumber, Id locationId, bool animated, QtCodeNavigateable::ScrollTarget target); + const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, QtCodeNavigateable::ScrollTarget target); signals: void scrollRequest(); @@ -172,7 +172,7 @@ private: } FilePath filePath; - uint lineNumber; + size_t lineNumber; Id locationId; bool animated; diff --git a/src/lib_gui/qt/element/code/QtCodeSnippet.cpp b/src/lib_gui/qt/element/code/QtCodeSnippet.cpp index 4919ea14..dbf1b6e7 100644 --- a/src/lib_gui/qt/element/code/QtCodeSnippet.cpp +++ b/src/lib_gui/qt/element/code/QtCodeSnippet.cpp @@ -40,7 +40,7 @@ QtCodeSnippet* QtCodeSnippet::merged( std::string secondCode = second->getCode(); int secondCodeStartIndex = 0; - for (uint i = second->getStartLineNumber(); i <= first->getEndLineNumber(); i++) + for (size_t i = second->getStartLineNumber(); i <= first->getEndLineNumber(); i++) { secondCodeStartIndex = secondCode.find("\n", secondCodeStartIndex) + 1; } @@ -124,12 +124,12 @@ QtCodeArea* QtCodeSnippet::getArea() const return m_codeArea; } -uint QtCodeSnippet::getStartLineNumber() const +size_t QtCodeSnippet::getStartLineNumber() const { return m_codeArea->getStartLineNumber(); } -uint QtCodeSnippet::getEndLineNumber() const +size_t QtCodeSnippet::getEndLineNumber() const { return m_codeArea->getEndLineNumber(); } @@ -163,12 +163,12 @@ void QtCodeSnippet::setIsActiveFile(bool isActiveFile) m_codeArea->setIsActiveFile(isActiveFile); } -uint QtCodeSnippet::getLineNumberForLocationId(Id locationId) const +size_t QtCodeSnippet::getLineNumberForLocationId(Id locationId) const { return m_codeArea->getLineNumberForLocationId(locationId); } -std::pair QtCodeSnippet::getLineNumbersForLocationId(Id locationId) const +std::pair QtCodeSnippet::getLineNumbersForLocationId(Id locationId) const { return m_codeArea->getLineNumbersForLocationId(locationId); } @@ -184,7 +184,7 @@ Id QtCodeSnippet::getFirstActiveLocationId(Id tokenId) const return m_codeArea->getLocationIdOfFirstActiveLocation(tokenId); } -QRectF QtCodeSnippet::getLineRectForLineNumber(uint lineNumber) const +QRectF QtCodeSnippet::getLineRectForLineNumber(size_t lineNumber) const { return m_codeArea->getLineRectForLineNumber(lineNumber); } diff --git a/src/lib_gui/qt/element/code/QtCodeSnippet.h b/src/lib_gui/qt/element/code/QtCodeSnippet.h index 82462c63..cba6aa87 100644 --- a/src/lib_gui/qt/element/code/QtCodeSnippet.h +++ b/src/lib_gui/qt/element/code/QtCodeSnippet.h @@ -32,8 +32,8 @@ public: QtCodeFile* getFile() const; QtCodeArea* getArea() const; - uint getStartLineNumber() const; - uint getEndLineNumber() const; + size_t getStartLineNumber() const; + size_t getEndLineNumber() const; int lineNumberDigits() const; @@ -44,11 +44,11 @@ public: void setIsActiveFile(bool isActiveFile); - uint getLineNumberForLocationId(Id locationId) const; - std::pair getLineNumbersForLocationId(Id locationId) const; + size_t getLineNumberForLocationId(Id locationId) const; + std::pair getLineNumbersForLocationId(Id locationId) const; Id getFirstActiveLocationId(Id tokenId) const; - QRectF getLineRectForLineNumber(uint lineNumber) const; + QRectF getLineRectForLineNumber(size_t lineNumber) const; std::string getCode() const; diff --git a/src/lib_gui/qt/network/QtUpdateChecker.cpp b/src/lib_gui/qt/network/QtUpdateChecker.cpp index 83981dd5..dfa739e7 100644 --- a/src/lib_gui/qt/network/QtUpdateChecker.cpp +++ b/src/lib_gui/qt/network/QtUpdateChecker.cpp @@ -8,9 +8,10 @@ #include "ApplicationSettings.h" #include "LicenseChecker.h" +#include "logging.h" #include "MessageStatus.h" #include "QtRequest.h" -#include "utility.h" +#include "TimeStamp.h" #include "utilityApp.h" #include "utilityUuid.h" #include "Version.h" diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp index baa6499f..4ef3eeb2 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp @@ -8,14 +8,15 @@ #include #include -#include "utilityQt.h" #include "ApplicationSettings.h" +#include "logging.h" #include "FileSystem.h" #include "MessageSwitchColorScheme.h" #include "ResourcePaths.h" -#include "utilityPathDetection.h" -#include "utilityApp.h" #include "utility.h" +#include "utilityApp.h" +#include "utilityPathDetection.h" +#include "utilityQt.h" QtProjectWizardContentPreferences::QtProjectWizardContentPreferences( QtProjectWizardWindow* window diff --git a/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathSourceMaven.cpp b/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathSourceMaven.cpp index 2bb54332..14888593 100644 --- a/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathSourceMaven.cpp +++ b/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathSourceMaven.cpp @@ -4,6 +4,7 @@ #include "Application.h" #include "ApplicationSettings.h" +#include "logging.h" #include "MessageStatus.h" #include "QtDialogView.h" #include "ScopedFunctor.h" diff --git a/src/lib_gui/qt/utility/QtHighlighter.cpp b/src/lib_gui/qt/utility/QtHighlighter.cpp index 3438c742..b74eff61 100644 --- a/src/lib_gui/qt/utility/QtHighlighter.cpp +++ b/src/lib_gui/qt/utility/QtHighlighter.cpp @@ -9,6 +9,7 @@ #include "ColorScheme.h" #include "FileSystem.h" +#include "logging.h" #include "ResourcePaths.h" #include "TextAccess.h" #include "tracing.h" diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 17f0cbe1..72a5bd03 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -329,45 +329,6 @@ DatabasePolicy QtDialogView::finishedIndexingDialog( return policy; } -int QtDialogView::confirm(const std::string& message, const std::vector& options) -{ - int result = -1; - m_resultReady = false; - - m_onQtThread2( - [=, &result]() - { - QMessageBox msgBox; - msgBox.setText(QString::fromStdString(message)); - - for (const std::string& option : options) - { - msgBox.addButton(QString::fromStdString(option), QMessageBox::AcceptRole); - } - - msgBox.exec(); - - for (int i = 0; i < msgBox.buttons().size(); i++) - { - if (msgBox.clickedButton() == msgBox.buttons().at(i)) - { - result = i; - break; - } - } - - m_resultReady = true; - } - ); - - while (!m_resultReady) - { - std::this_thread::sleep_for(std::chrono::milliseconds(25)); - } - - return result; -} - int QtDialogView::confirm(const std::wstring& message, const std::vector& options) { int result = -1; diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index 0077210c..fb7dfb04 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -48,7 +48,6 @@ public: size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted) override; - int confirm(const std::string& message, const std::vector& options) override; int confirm(const std::wstring& message, const std::vector& options) override; void setParentWindow(QtWindow* window); diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index 9fa4d83c..6791af4f 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -341,7 +341,7 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error) m_model->item(rowNumber, Column::FILE)->setToolTip(QString::fromStdWString(error.filePath)); item = new QStandardItem(); - item->setData(QVariant(error.lineNumber), Qt::DisplayRole); + item->setData(QVariant(qlonglong(error.lineNumber)), Qt::DisplayRole); m_model->setItem(rowNumber, Column::LINE, item); m_model->setItem(rowNumber, Column::INDEXED, new QStandardItem(error.indexed ? "yes" : "no")); diff --git a/src/lib_gui/qt/window/QtAbout.cpp b/src/lib_gui/qt/window/QtAbout.cpp index c7e86d1e..972c56ad 100644 --- a/src/lib_gui/qt/window/QtAbout.cpp +++ b/src/lib_gui/qt/window/QtAbout.cpp @@ -8,7 +8,7 @@ #include "QtDeviceScaledPixmap.h" #include "ResourcePaths.h" #include "SqliteIndexStorage.h" -#include "utility.h" +#include "utilityApp.h" #include "utilityQt.h" #include "Version.h" diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 6240a4ce..fe597020 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -5,13 +5,13 @@ #include #include -#include "utilityQt.h" -#include "QtHelpButton.h" -#include "QtProgressBar.h" #include "MessageErrorsHelpMessage.h" #include "MessageIndexingInterrupted.h" +#include "QtHelpButton.h" +#include "QtProgressBar.h" #include "ResourcePaths.h" -#include "utility.h" +#include "TimeStamp.h" +#include "utilityQt.h" QtIndexingDialog::QtIndexingDialog(QWidget* parent) : QtWindow(true, parent) @@ -206,7 +206,7 @@ void QtIndexingDialog::setupReport( ); layout->addSpacing(12); - createMessageLabel(layout)->setText("Time: " + QString::fromStdString(utility::timeToString(time))); + createMessageLabel(layout)->setText("Time: " + QString::fromStdString(TimeStamp::secondsToString(time))); layout->addSpacing(12); addErrorWidget(layout); diff --git a/src/lib_gui/qt/window/QtPreferencesWindow.cpp b/src/lib_gui/qt/window/QtPreferencesWindow.cpp index d17aba47..2e874ee9 100644 --- a/src/lib_gui/qt/window/QtPreferencesWindow.cpp +++ b/src/lib_gui/qt/window/QtPreferencesWindow.cpp @@ -77,9 +77,9 @@ void QtPreferencesWindow::handleNext() if (needsRestart) { app->getDialogView(DialogView::UseCase::PROJECT_SETUP)->confirm( - "

Please restart the application for all changes to take effect.

Note: These changes may harm " - "the execution of the application. In case the application is not useable anymore, please run the " - "'resetPreferences.sh' script located in your install directory.

" + L"

Please restart the application for all changes to take effect.

Note: These changes may harm " + L"the execution of the application. In case the application is not useable anymore, please run the " + L"'resetPreferences.sh' script located in your install directory.

" ); } diff --git a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp index 2dfc5661..3f97df44 100644 --- a/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/cxx_header/CxxVs10To14HeaderPathDetector.cpp @@ -6,8 +6,9 @@ #include #include "FilePath.h" -#include "utilityCxxHeaderDetection.h" +#include "logging.h" #include "utility.h" +#include "utilityCxxHeaderDetection.h" CxxVs10To14HeaderPathDetector::CxxVs10To14HeaderPathDetector(VisualStudioType type, bool isExpress, ApplicationArchitectureType architecture) : PathDetector(visualStudioTypeToString(type) + (isExpress ? " Express" : "") + (architecture == APPLICATION_ARCHITECTURE_X86_64 ? " 64 Bit" : "")) diff --git a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp index 256dc1ea..7e4d2e45 100644 --- a/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp +++ b/src/lib_gui/utility/path_detector/java_runtime/JavaPathDetectorWindows.cpp @@ -4,7 +4,7 @@ #include #include "FilePath.h" -#include "utility.h" +#include "utilityApp.h" JavaPathDetectorWindows::JavaPathDetectorWindows(const std::string javaVersion) : JavaPathDetector("Java " + javaVersion + " for Windows", javaVersion) diff --git a/src/lib_gui/utility/utilityApp.cpp b/src/lib_gui/utility/utilityApp.cpp index 9448413f..2c7e287a 100644 --- a/src/lib_gui/utility/utilityApp.cpp +++ b/src/lib_gui/utility/utilityApp.cpp @@ -1,5 +1,8 @@ #include "utilityApp.h" +#include +#include + #include #include #include @@ -281,3 +284,13 @@ std::string utility::getOsTypeString() } return "unknown"; } + +ApplicationArchitectureType utility::getApplicationArchitectureType() +{ +#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) || defined(WIN64) + return APPLICATION_ARCHITECTURE_X86_64; +#else + return APPLICATION_ARCHITECTURE_X86_32; +#endif + return APPLICATION_ARCHITECTURE_UNKNOWN; +} diff --git a/src/lib_gui/utility/utilityApp.h b/src/lib_gui/utility/utilityApp.h index a553bf95..a9f21578 100644 --- a/src/lib_gui/utility/utilityApp.h +++ b/src/lib_gui/utility/utilityApp.h @@ -1,10 +1,9 @@ #ifndef UTILITY_APP_H #define UTILITY_APP_H -#include -#include #include +#include "ApplicationArchitectureType.h" #include "OsType.h" #include "FilePath.h" @@ -12,8 +11,10 @@ class License; namespace utility { - std::pair executeProcess(const std::string& command, const FilePath& workingDirectory = FilePath(), const int timeout = 30000); - std::string executeProcessUntilNoOutput(const std::string& command, const FilePath& workingDirectory, int waitTime = 10000); + std::pair executeProcess( + const std::string& command, const FilePath& workingDirectory = FilePath(), const int timeout = 30000); + std::string executeProcessUntilNoOutput( + const std::string& command, const FilePath& workingDirectory, int waitTime = 10000); int executeProcessAndGetExitCode( const std::wstring& commandPath, const std::vector& commandArguments, @@ -28,6 +29,7 @@ namespace utility OsType getOsType(); std::string getOsTypeString(); + ApplicationArchitectureType getApplicationArchitectureType(); } #endif // UTILITY_APP_H diff --git a/src/lib_java/project/SourceGroupJavaGradle.cpp b/src/lib_java/project/SourceGroupJavaGradle.cpp index ba7c3f6d..3a908d7a 100644 --- a/src/lib_java/project/SourceGroupJavaGradle.cpp +++ b/src/lib_java/project/SourceGroupJavaGradle.cpp @@ -1,13 +1,14 @@ #include "SourceGroupJavaGradle.h" +#include "Application.h" #include "DialogView.h" -#include "SourceGroupSettingsJavaGradle.h" #include "FileSystem.h" +#include "logging.h" +#include "SourceGroupSettingsJavaGradle.h" #include "ScopedFunctor.h" #include "utility.h" #include "utilityGradle.h" #include "utilityJava.h" -#include "Application.h" SourceGroupJavaGradle::SourceGroupJavaGradle(std::shared_ptr settings) : m_settings(settings) diff --git a/src/lib_java/project/SourceGroupJavaMaven.cpp b/src/lib_java/project/SourceGroupJavaMaven.cpp index 48f98b6b..c3c871ea 100644 --- a/src/lib_java/project/SourceGroupJavaMaven.cpp +++ b/src/lib_java/project/SourceGroupJavaMaven.cpp @@ -1,15 +1,16 @@ #include "SourceGroupJavaMaven.h" -#include "DialogView.h" +#include "Application.h" #include "ApplicationSettings.h" -#include "SourceGroupSettingsJavaMaven.h" +#include "DialogView.h" #include "FileSystem.h" +#include "logging.h" #include "MessageStatus.h" #include "ScopedFunctor.h" +#include "SourceGroupSettingsJavaMaven.h" #include "utility.h" #include "utilityJava.h" #include "utilityMaven.h" -#include "Application.h" SourceGroupJavaMaven::SourceGroupJavaMaven(std::shared_ptr settings) : m_settings(settings) diff --git a/src/lib_java/utility/utilityMaven.cpp b/src/lib_java/utility/utilityMaven.cpp index 12b28860..4182b2d4 100644 --- a/src/lib_java/utility/utilityMaven.cpp +++ b/src/lib_java/utility/utilityMaven.cpp @@ -5,6 +5,7 @@ #include "Application.h" #include "ApplicationSettings.h" #include "FilePath.h" +#include "logging.h" #include "MessageStatus.h" #include "TextAccess.h" #include "utility.h" diff --git a/src/test/CxxIndexSampleProjectsTestSuite.h b/src/test/CxxIndexSampleProjectsTestSuite.h index 770aaea0..a4c5499d 100644 --- a/src/test/CxxIndexSampleProjectsTestSuite.h +++ b/src/test/CxxIndexSampleProjectsTestSuite.h @@ -11,6 +11,7 @@ #include "ParserClientImpl.h" #include "TestIntermediateStorage.h" #include "TextAccess.h" +#include "TimeStamp.h" #include "utility.h" #include "utilityString.h"