logic: Show unknown progress dialog when refreshing (issue 341)

* refactored dialog handling
* Application always provides a DialogView instance

bug id = 341
This commit is contained in:
Eberhard Graether
2017-04-19 13:04:46 +02:00
parent c4deca4662
commit 9d718d6a87
13 changed files with 81 additions and 114 deletions
+12 -25
View File
@@ -32,22 +32,13 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
if (dialogView)
{
dialogView->showStatusDialog("Finish Indexing", "Optimizing database");
}
dialogView->showUnknownProgressDialog("Finish Indexing", "Optimizing database");
m_storage->optimizeMemory();
if (dialogView)
{
dialogView->showStatusDialog("Finish Indexing", "Building caches");
}
dialogView->showUnknownProgressDialog("Finish Indexing", "Building caches");
m_storage->buildCaches();
if (dialogView)
{
dialogView->hideStatusDialog();
}
dialogView->hideUnknownProgressDialog();
MessageFinishedParsing().dispatch();
float time = utility::duration(start);
@@ -72,19 +63,15 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
int sourceFileCount = 0;
blackboard->get("source_file_count", sourceFileCount);
if (dialogView)
{
StorageStats stats = m_storageAccess->getStorageStats();
dialogView->finishedIndexingDialog(
indexedSourceFileCount,
sourceFileCount,
stats.completedFileCount,
stats.fileCount,
time,
m_storageAccess->getErrorCount()
);
}
StorageStats stats = m_storageAccess->getStorageStats();
dialogView->finishedIndexingDialog(
indexedSourceFileCount,
sourceFileCount,
stats.completedFileCount,
stats.fileCount,
time,
m_storageAccess->getErrorCount()
);
return STATE_SUCCESS;
}