diff --git a/src/lib/data/indexer/IndexerCommand.cpp b/src/lib/data/indexer/IndexerCommand.cpp index 0f7fc229..490bf51f 100644 --- a/src/lib/data/indexer/IndexerCommand.cpp +++ b/src/lib/data/indexer/IndexerCommand.cpp @@ -30,17 +30,17 @@ size_t IndexerCommand::getByteSize() const return size; } -FilePath IndexerCommand::getSourceFilePath() const +const FilePath& IndexerCommand::getSourceFilePath() const { return m_sourceFilePath; } -std::set IndexerCommand::getIndexedPaths() const +const std::set& IndexerCommand::getIndexedPaths() const { return m_indexedPaths; } -std::set IndexerCommand::getExcludedPath() const +const std::set& IndexerCommand::getExcludedPath() const { return m_excludedPaths; } diff --git a/src/lib/data/indexer/IndexerCommand.h b/src/lib/data/indexer/IndexerCommand.h index 44d7a4f2..f9a20a02 100644 --- a/src/lib/data/indexer/IndexerCommand.h +++ b/src/lib/data/indexer/IndexerCommand.h @@ -17,9 +17,9 @@ public: virtual size_t getByteSize() const; - FilePath getSourceFilePath() const; - std::set getIndexedPaths() const; - std::set getExcludedPath() const; + const FilePath& getSourceFilePath() const; + const std::set& getIndexedPaths() const; + const std::set& getExcludedPath() const; virtual bool preprocessorOnly() const = 0; virtual void setPreprocessorOnly(bool preprocessorOnly) = 0; diff --git a/src/lib/data/indexer/TaskBuildIndex.cpp b/src/lib/data/indexer/TaskBuildIndex.cpp index 00a9c80e..7dfab81b 100644 --- a/src/lib/data/indexer/TaskBuildIndex.cpp +++ b/src/lib/data/indexer/TaskBuildIndex.cpp @@ -1,7 +1,6 @@ #include "data/indexer/TaskBuildIndex.h" #include "utility/AppPath.h" -#include "utility/file/FileRegisterStateData.h" #include "utility/logging/FileLogger.h" #include "utility/scheduling/Blackboard.h" #include "utility/UserPaths.h" @@ -23,12 +22,10 @@ TaskBuildIndex::TaskBuildIndex( unsigned int processCount, std::shared_ptr indexerCommandList, std::shared_ptr storageProvider, - std::shared_ptr fileRegisterStateData, bool multiProcessIndexing ) : m_indexerCommandList(indexerCommandList) , m_storageProvider(storageProvider) - , m_fileRegisterStateData(fileRegisterStateData) , m_multiProcessIndexing(multiProcessIndexing) , m_interprocessIndexerCommandManager(Application::getUUID(), 0, true) , m_interprocessIndexingStatusManager(Application::getUUID(), 0, true) diff --git a/src/lib/data/indexer/TaskBuildIndex.h b/src/lib/data/indexer/TaskBuildIndex.h index 36ff8d82..135f9054 100644 --- a/src/lib/data/indexer/TaskBuildIndex.h +++ b/src/lib/data/indexer/TaskBuildIndex.h @@ -3,7 +3,6 @@ #include -#include "utility/file/FileRegisterStateData.h" #include "utility/messaging/MessageListener.h" #include "utility/messaging/type/MessageInterruptTasks.h" #include "utility/scheduling/Task.h" @@ -13,7 +12,6 @@ #include "data/indexer/interprocess/InterprocessIntermediateStorageManager.h" class DialogView; -class FileRegisterStateData; class StorageProvider; class IndexerCommandList; @@ -26,7 +24,6 @@ public: unsigned int processCount, std::shared_ptr indexerCommandList, std::shared_ptr storageProvider, - std::shared_ptr fileRegisterStateData, bool multiProcessIndexing ); @@ -48,7 +45,6 @@ protected: std::shared_ptr m_indexerCommandList; std::shared_ptr m_storageProvider; - std::shared_ptr m_fileRegisterStateData; bool m_multiProcessIndexing; InterprocessIndexerCommandManager m_interprocessIndexerCommandManager; diff --git a/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp b/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp index 9a486652..05c9bec9 100644 --- a/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp +++ b/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp @@ -39,7 +39,7 @@ void InterprocessIndexer::work() data.setIndexedFiles(m_interprocessIndexingStatusManager.getIndexedFiles()); std::shared_ptr fileRegister = std::make_shared( - data, indexerCommand->getIndexedPaths(), indexerCommand->getExcludedPath() + data, indexerCommand->getSourceFilePath(), indexerCommand->getIndexedPaths(), indexerCommand->getExcludedPath() ); std::shared_ptr result = indexer->index(indexerCommand, fileRegister); diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index fc387cfb..e6a78725 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -20,7 +20,6 @@ #include "settings/ProjectSettings.h" #include "utility/file/FilePath.h" -#include "utility/file/FileRegisterStateData.h" #include "utility/file/FileSystem.h" #include "utility/messaging/type/MessageClearErrorCount.h" #include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" @@ -466,7 +465,6 @@ void Project::buildIndex(const std::set& filesToClean, bool fullRefres indexerCommandList->shuffle(); } - std::shared_ptr fileRegisterStateData = std::make_shared(); std::shared_ptr storageProvider = std::make_shared(); // add tasks for setting some variables on the blackboard that are used during indexing taskSequential->addTask(std::make_shared>("source_file_count", indexerCommandList->size())); @@ -485,7 +483,7 @@ void Project::buildIndex(const std::set& filesToClean, bool fullRefres taskParallelIndexing->addChildTasks( std::make_shared(TaskDecoratorRepeat::CONDITION_WHILE_SUCCESS, Task::STATE_SUCCESS)->addChildTask( - std::make_shared(indexerThreadCount, indexerCommandList, storageProvider, fileRegisterStateData, multiProcess) + std::make_shared(indexerThreadCount, indexerCommandList, storageProvider, multiProcess) ) ); } diff --git a/src/lib/utility/file/FileRegister.cpp b/src/lib/utility/file/FileRegister.cpp index 8f581532..3986265e 100644 --- a/src/lib/utility/file/FileRegister.cpp +++ b/src/lib/utility/file/FileRegister.cpp @@ -2,20 +2,35 @@ #include "utility/file/FilePath.h" -FileRegister::FileRegister(const FileRegisterStateData& stateData, const std::set& indexedPaths, const std::set& excludedPaths) +FileRegister::FileRegister( + const FileRegisterStateData& stateData, + const FilePath& currentPath, + const std::set& indexedPaths, + const std::set& excludedPaths +) : m_stateData(stateData) + , m_currentPath(currentPath) , m_indexedPaths(indexedPaths) , m_excludedPaths(excludedPaths) , m_hasFilePathCache( [&](std::string f){ const FilePath filePath(f); bool ret = false; - for (const FilePath& indexedPath: m_indexedPaths) + + if (filePath == m_currentPath) { - if (indexedPath.contains(filePath)) + ret = true; + } + + if (!ret) + { + for (const FilePath& indexedPath: m_indexedPaths) { - ret = true; - break; + if (indexedPath.contains(filePath)) + { + ret = true; + break; + } } } diff --git a/src/lib/utility/file/FileRegister.h b/src/lib/utility/file/FileRegister.h index 619fb3e1..13ce5548 100644 --- a/src/lib/utility/file/FileRegister.h +++ b/src/lib/utility/file/FileRegister.h @@ -9,7 +9,12 @@ class FileRegister { public: - FileRegister(const FileRegisterStateData& stateData, const std::set& indexedPaths, const std::set& excludedPaths); + FileRegister( + const FileRegisterStateData& stateData, + const FilePath& currentPath, + const std::set& indexedPaths, + const std::set& excludedPaths + ); virtual ~FileRegister(); const FileRegisterStateData& getStateData() const; @@ -21,6 +26,7 @@ public: private: FileRegisterStateData m_stateData; + const FilePath& m_currentPath; const std::set m_indexedPaths; const std::set m_excludedPaths; mutable Cache m_hasFilePathCache; diff --git a/src/lib_gui/qt/element/QtStatusBar.cpp b/src/lib_gui/qt/element/QtStatusBar.cpp index 60fe71fc..456781ca 100644 --- a/src/lib_gui/qt/element/QtStatusBar.cpp +++ b/src/lib_gui/qt/element/QtStatusBar.cpp @@ -72,8 +72,11 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader m_loader.hide(); } - m_textString = text; - m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(m_textString), Qt::ElideRight, m_text.width())); + if (text.size()) + { + m_textString = text; + m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdString(m_textString), Qt::ElideRight, m_text.width())); + } } void QtStatusBar::setErrorCount(ErrorCountInfo errorCount) diff --git a/src/test/helper/TestFileRegister.cpp b/src/test/helper/TestFileRegister.cpp index b89cedb1..c6ef27d5 100644 --- a/src/test/helper/TestFileRegister.cpp +++ b/src/test/helper/TestFileRegister.cpp @@ -1,7 +1,7 @@ #include "TestFileRegister.h" TestFileRegister::TestFileRegister() - : FileRegister(FileRegisterStateData(), std::set(), std::set()) + : FileRegister(FileRegisterStateData(), FilePath(), std::set(), std::set()) { }