diff options
author | Marco Bubke <marco.bubke@qt.io> | 2018-09-27 17:52:44 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-10-08 08:20:22 +0000 |
commit | 391cfab5d7cb7f4b38cf4a73995ac84b5b3a6ff9 (patch) | |
tree | 9cb7902e34339283d9caf3703706e2036b6c5ad4 /src/plugins/clangrefactoring | |
parent | ffc070a3f2605d4b85d839830eb4f30120415c9b (diff) | |
download | qt-creator-391cfab5d7cb7f4b38cf4a73995ac84b5b3a6ff9.tar.gz |
Clang: Add progress bars for creating PCHs and indexing
Task-number: QTCREATORBUG-21112
Change-Id: Ie0c00a58f479a2fe7cbc7322490808509733ff0f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/plugins/clangrefactoring')
-rw-r--r-- | src/plugins/clangrefactoring/clangrefactoringplugin.cpp | 10 | ||||
-rw-r--r-- | src/plugins/clangrefactoring/refactoringclient.cpp | 5 | ||||
-rw-r--r-- | src/plugins/clangrefactoring/refactoringclient.h | 9 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp index a0db471291..917823152e 100644 --- a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp +++ b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp @@ -34,11 +34,13 @@ #include "symbolquery.h" #include <clangpchmanager/clangpchmanagerplugin.h> +#include <clangpchmanager/progressmanager.h> #include <clangsupport/refactoringdatabaseinitializer.h> #include <cpptools/cppmodelmanager.h> #include <coreplugin/icore.h> +#include <coreplugin/progressmanager/progressmanager.h> #include <extensionsystem/pluginmanager.h> #include <cpptools/cpptoolsconstants.h> @@ -46,7 +48,6 @@ #include <filepathcaching.h> #include <sqlitedatabase.h> - #include <utils/hostosinfo.h> #include <QDir> @@ -79,13 +80,16 @@ public: Sqlite::Database database{Utils::PathString{Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}, 1000ms}; ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> databaseInitializer{database}; ClangBackEnd::FilePathCaching filePathCache{database}; - RefactoringClient refactoringClient; + ClangPchManager::ProgressManager progressManager{ + [] (QFutureInterface<void> &promise) { + auto title = QCoreApplication::translate("ClangRefactoringProgressManager", "C++ Indexing"); + Core::ProgressManager::addTask(promise.future(), title, "clang indexing", nullptr);}}; + RefactoringClient refactoringClient{progressManager}; QtCreatorEditorManager editorManager{filePathCache}; ClangBackEnd::RefactoringConnectionClient connectionClient{&refactoringClient}; QuerySqliteReadStatementFactory statementFactory{database}; SymbolQuery<QuerySqliteReadStatementFactory> symbolQuery{statementFactory}; RefactoringEngine engine{connectionClient.serverProxy(), refactoringClient, filePathCache, symbolQuery}; - QtCreatorSearch qtCreatorSearch; QtCreatorClangQueryFindFilter qtCreatorfindFilter{connectionClient.serverProxy(), qtCreatorSearch, diff --git a/src/plugins/clangrefactoring/refactoringclient.cpp b/src/plugins/clangrefactoring/refactoringclient.cpp index 04fc1bf08e..3bdeb9dd53 100644 --- a/src/plugins/clangrefactoring/refactoringclient.cpp +++ b/src/plugins/clangrefactoring/refactoringclient.cpp @@ -70,6 +70,11 @@ void RefactoringClient::setLocalRenamingCallback( m_localRenamingCallback = std::move(localRenamingCallback); } +void RefactoringClient::progress(ClangBackEnd::ProgressMessage &&message) +{ + m_progressManager.setProgress(message.progress, message.total); +} + void RefactoringClient::setRefactoringEngine(RefactoringEngine *refactoringEngine) { m_refactoringEngine = refactoringEngine; diff --git a/src/plugins/clangrefactoring/refactoringclient.h b/src/plugins/clangrefactoring/refactoringclient.h index fbf10d7294..f3d9e218e5 100644 --- a/src/plugins/clangrefactoring/refactoringclient.h +++ b/src/plugins/clangrefactoring/refactoringclient.h @@ -30,6 +30,7 @@ #include "searchhandle.h" #include <refactoringclientinterface.h> +#include <clangpchmanager/progressmanager.h> #include <functional> @@ -48,6 +49,10 @@ class ClangQueryHighlighter; class RefactoringClient final : public ClangBackEnd::RefactoringClientInterface { public: + RefactoringClient(ClangPchManager::ProgressManagerInterface &progressManager) + : m_progressManager(progressManager) + {} + void alive() override; void sourceLocationsForRenamingMessage( ClangBackEnd::SourceLocationsForRenamingMessage &&message) override; @@ -58,6 +63,8 @@ public: void setLocalRenamingCallback( CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback) override; + void progress(ClangBackEnd::ProgressMessage &&message) override; + void setRefactoringEngine(ClangRefactoring::RefactoringEngine *refactoringEngine); void setSearchHandle(ClangRefactoring::SearchHandle *searchHandleInterface); ClangRefactoring::SearchHandle *searchHandle() const; @@ -72,6 +79,7 @@ public: void setRefactoringConnectionClient(ClangBackEnd::RefactoringConnectionClient *connectionClient); + unittest_public: void addSearchResult(const ClangBackEnd::SourceRangeWithTextContainer &sourceRange); @@ -88,6 +96,7 @@ private: RefactoringEngine *m_refactoringEngine = nullptr; ClangQueryExampleHighlighter *m_clangQueryExampleHighlighter = nullptr; ClangQueryHighlighter *m_clangQueryHighlighter = nullptr; + ClangPchManager::ProgressManagerInterface &m_progressManager; uint m_expectedResultCount = 0; uint m_resultCounter = 0; }; |