From 65b5bd47f62c1a52e5cbe73b32cf9946e34e9e96 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Fri, 19 May 2017 14:26:52 +0200 Subject: [PATCH] logic: Fixed indexing progress file count in status bar and status view (issue #387) bug id = 387 --- src/lib/component/view/DialogView.cpp | 3 ++- src/lib/component/view/DialogView.h | 3 ++- src/lib/data/indexer/TaskBuildIndex.cpp | 8 ++++++-- src/lib/data/indexer/TaskBuildIndex.h | 1 + src/lib/data/parser/TaskParseWrapper.cpp | 2 +- src/lib_gui/qt/view/QtDialogView.cpp | 9 +++++---- src/lib_gui/qt/view/QtDialogView.h | 3 ++- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index 2afb89de..c7136923 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -31,7 +31,8 @@ DialogView::IndexingOptions DialogView::startIndexingDialog( return IndexingOptions(); } -void DialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath) +void DialogView::updateIndexingDialog( + size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath) { } diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index 7dc62ee6..4d027927 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -41,7 +41,8 @@ public: virtual IndexingOptions startIndexingDialog( size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, IndexingOptions options); - virtual void updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath); + virtual void updateIndexingDialog( + size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath); virtual void finishedIndexingDialog( size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted); diff --git a/src/lib/data/indexer/TaskBuildIndex.cpp b/src/lib/data/indexer/TaskBuildIndex.cpp index dac8ee6c..00a9c80e 100644 --- a/src/lib/data/indexer/TaskBuildIndex.cpp +++ b/src/lib/data/indexer/TaskBuildIndex.cpp @@ -35,12 +35,14 @@ TaskBuildIndex::TaskBuildIndex( , m_processCount(processCount) , m_interrupted(false) , m_lastCommandCount(0) + , m_indexingFileCount(0) , m_runningThreadCount(0) { } void TaskBuildIndex::doEnter(std::shared_ptr blackboard) { + m_indexingFileCount = 0; updateIndexingDialog(blackboard, FilePath()); { @@ -93,6 +95,7 @@ Task::TaskState TaskBuildIndex::doUpdate(std::shared_ptr blackboard) std::vector indexingFiles = m_interprocessIndexingStatusManager.getCurrentlyIndexedSourceFilePaths(); for (const FilePath& path : indexingFiles) { + m_indexingFileCount++; updateIndexingDialog(blackboard, path); } @@ -255,7 +258,8 @@ bool TaskBuildIndex::fetchIntermediateStorages(std::shared_ptr black return true; } -void TaskBuildIndex::updateIndexingDialog(std::shared_ptr blackboard, const FilePath& sourcePath) +void TaskBuildIndex::updateIndexingDialog( + std::shared_ptr blackboard, const FilePath& sourcePath) { // TODO: factor in unindexed files... int sourceFileCount = 0; @@ -269,7 +273,7 @@ void TaskBuildIndex::updateIndexingDialog(std::shared_ptr blackboard if (std::shared_ptr dialogView = Application::getInstance()->getDialogView()) { dialogView->updateIndexingDialog( - indexedSourceFileCount, sourceFileCount, sourcePath.str() + m_indexingFileCount, indexedSourceFileCount, sourceFileCount, sourcePath.str() ); } } diff --git a/src/lib/data/indexer/TaskBuildIndex.h b/src/lib/data/indexer/TaskBuildIndex.h index 4358f124..36ff8d82 100644 --- a/src/lib/data/indexer/TaskBuildIndex.h +++ b/src/lib/data/indexer/TaskBuildIndex.h @@ -57,6 +57,7 @@ protected: unsigned int m_processCount; bool m_interrupted; size_t m_lastCommandCount; + size_t m_indexingFileCount; // store as plain pointers to avoid deallocation issues when closing app during indexing std::vector m_processThreads; diff --git a/src/lib/data/parser/TaskParseWrapper.cpp b/src/lib/data/parser/TaskParseWrapper.cpp index b79a6a67..0624d3d4 100644 --- a/src/lib/data/parser/TaskParseWrapper.cpp +++ b/src/lib/data/parser/TaskParseWrapper.cpp @@ -29,7 +29,7 @@ void TaskParseWrapper::doEnter(std::shared_ptr blackboard) blackboard->get("source_file_count", sourceFileCount); if (std::shared_ptr dialogView = Application::getInstance()->getDialogView()) { - dialogView->updateIndexingDialog(0, sourceFileCount, ""); + dialogView->updateIndexingDialog(0, 0, sourceFileCount, ""); } m_start = utility::durationStart(); diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 89002698..3da995a1 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -144,13 +144,14 @@ DialogView::IndexingOptions QtDialogView::startIndexingDialog( return result; } -void QtDialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath) +void QtDialogView::updateIndexingDialog( + size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath) { if (sourcePath.size()) { std::stringstream ss; - ss << "Indexing files: ["; - ss << fileCount << "/"; + ss << "Indexing file: ["; + ss << startedFileCount << "/"; ss << totalFileCount << "] "; ss << sourcePath; MessageStatus(ss.str(), false, true).dispatch(); @@ -170,7 +171,7 @@ void QtDialogView::updateIndexingDialog(size_t fileCount, size_t totalFileCount, if (window && window->getType() == QtIndexingDialog::DIALOG_INDEXING) { - window->updateIndexingProgress(fileCount, totalFileCount, sourcePath); + window->updateIndexingProgress(finishedFileCount, totalFileCount, sourcePath); setUIBlocked(true); } } diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index d1c60919..e5521a03 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -36,7 +36,8 @@ public: virtual DialogView::IndexingOptions startIndexingDialog( size_t cleanFileCount, size_t indexFileCount, size_t totalFileCount, DialogView::IndexingOptions options) override; - virtual void updateIndexingDialog(size_t fileCount, size_t totalFileCount, std::string sourcePath) override; + virtual void updateIndexingDialog( + size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath) override; virtual void finishedIndexingDialog( size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted) override;