ui: Indexing UI

* Added DialogView with QtDialogView implementation to handle information dialogs
* Implemented QtIndexingDialog class that covers all different dialogs for indexing
* Directly communicate with DialogView from Prpject and all Tasks involved in indexing
* Block QtMainWindow UI while indexing
This commit is contained in:
Eberhard Graether
2016-08-23 23:45:45 +02:00
parent 377f0ef34f
commit 2c90b75a9f
70 changed files with 1565 additions and 375 deletions
+2
View File
@@ -366,6 +366,8 @@ void PersistentStorage::logStats() const
void PersistentStorage::startParsing()
{
clearCaches();
MessageClearErrorCount().dispatch();
m_sqliteStorage.setVersion();
+13 -27
View File
@@ -1,58 +1,44 @@
#include "data/TaskCleanStorage.h"
#include "component/view/DialogView.h"
#include "data/PersistentStorage.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/utility.h"
TaskCleanStorage::TaskCleanStorage(PersistentStorage* storage, const std::vector<FilePath>& filePaths)
TaskCleanStorage::TaskCleanStorage(
PersistentStorage* storage, const std::vector<FilePath>& filePaths, DialogView* dialogView
)
: m_storage(storage)
, m_filePaths(filePaths)
, m_fileCount(filePaths.size())
, m_dialogView(dialogView)
{
}
void TaskCleanStorage::enter()
{
m_start = utility::durationStart();
m_dialogView->showProgressDialog("Clearing Files", std::to_string(m_filePaths.size()) + " Files");
}
Task::TaskState TaskCleanStorage::update()
{
if (m_filePaths.size())
{
std::stringstream ss;
ss << "clearing " << m_filePaths.size() << " files (ESC to quit)";
MessageStatus(ss.str(), false, true).dispatch();
m_storage->clearFileElements(m_filePaths);
m_storage->clearFileElements(m_filePaths);
m_filePaths.clear();
return Task::STATE_RUNNING;
}
if (m_fileCount)
{
MessageStatus("Clearing caches (ESC to quit)", false, true).dispatch();
m_storage->clearCaches();
}
m_filePaths.clear();
return Task::STATE_FINISHED;
}
void TaskCleanStorage::exit()
{
std::stringstream ss;
ss << "clearing files done, ";
ss << std::setprecision(2) << std::fixed << utility::duration(m_start) << " seconds";
MessageStatus(ss.str()).dispatch();
m_dialogView->hideProgressDialog();
}
void TaskCleanStorage::interrupt()
{
MessageStatus("clearing files interrupted", false, true).dispatch();
}
void TaskCleanStorage::revert()
{
}
void TaskCleanStorage::abort()
{
}
+5 -5
View File
@@ -5,8 +5,8 @@
#include "utility/file/FilePath.h"
#include "utility/scheduling/Task.h"
#include "utility/TimePoint.h"
class DialogView;
class PersistentStorage;
class TaskCleanStorage
@@ -15,7 +15,8 @@ class TaskCleanStorage
public:
TaskCleanStorage(
PersistentStorage* storage,
const std::vector<FilePath>& filePaths
const std::vector<FilePath>& filePaths,
DialogView* dialogView
);
virtual void enter();
@@ -24,13 +25,12 @@ public:
virtual void interrupt();
virtual void revert();
virtual void abort();
private:
PersistentStorage* m_storage;
std::vector<FilePath> m_filePaths;
const size_t m_fileCount;
TimePoint m_start;
DialogView* m_dialogView;
};
#endif // TASK_PARSE_CXX_H
+10 -4
View File
@@ -10,9 +10,10 @@
#include "utility/scheduling/Task.h"
#include "utility/TimePoint.h"
class PersistentStorage;
class FileRegister;
class CxxParser;
class DialogView;
class FileRegister;
class PersistentStorage;
namespace clang
{
@@ -32,7 +33,8 @@ public:
PersistentStorage* storage,
std::shared_ptr<std::mutex> storageMutex,
std::shared_ptr<FileRegister> fileRegister,
const Parser::Arguments& arguments
const Parser::Arguments& arguments,
DialogView* dialogView
);
virtual void enter();
@@ -41,13 +43,17 @@ public:
virtual void interrupt();
virtual void revert();
virtual void abort();
private:
PersistentStorage* m_storage;
std::shared_ptr<std::mutex> m_storageMutex;
const Parser::Arguments m_arguments;
DialogView* m_dialogView;
std::shared_ptr<CxxParser> m_parser;
std::shared_ptr<ParserClientImpl> m_parserClient;
const Parser::Arguments m_arguments;
bool m_isCDB;
std::shared_ptr<clang::tooling::JSONCompilationDatabase> m_cdb;
+7 -2
View File
@@ -8,8 +8,9 @@
#include "utility/scheduling/TaskDecorator.h"
#include "utility/TimePoint.h"
class PersistentStorage;
class DialogView;
class FileRegister;
class PersistentStorage;
class TaskParseWrapper
: public TaskDecorator
@@ -17,7 +18,8 @@ class TaskParseWrapper
public:
TaskParseWrapper(
PersistentStorage* storage,
std::shared_ptr<FileRegister> fileRegister
std::shared_ptr<FileRegister> fileRegister,
DialogView* dialogView
);
virtual ~TaskParseWrapper();
@@ -27,10 +29,13 @@ public:
virtual void interrupt();
virtual void revert();
virtual void abort();
private:
PersistentStorage* m_storage;
std::shared_ptr<FileRegister> m_fileRegister;
DialogView* m_dialogView;
TimePoint m_start;
};
+5 -1
View File
@@ -6,6 +6,7 @@
#include "data/parser/Parser.h"
#include "utility/scheduling/Task.h"
class DialogView;
class FileRegister;
class PersistentStorage;
@@ -17,7 +18,8 @@ public:
PersistentStorage* storage,
std::shared_ptr<std::mutex> storageMutex,
std::shared_ptr<FileRegister> fileRegister,
const Parser::Arguments& arguments
const Parser::Arguments& arguments,
DialogView* dialogView
);
virtual void enter();
@@ -26,12 +28,14 @@ public:
virtual void interrupt();
virtual void revert();
virtual void abort();
private:
PersistentStorage* m_storage;
std::shared_ptr<std::mutex> m_storageMutex;
std::shared_ptr<FileRegister> m_fileRegister;
Parser::Arguments m_arguments;
DialogView* m_dialogView;
};
#endif // TASK_PARSE_JAVA_H