diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp index e2b4ffb8ee886d86f48b222a61a3d8598a449cee..cefa6894f812545f0f44ef4955f8c40e5f09455f 100644 --- a/src/plugins/cpptools/builtinindexingsupport.cpp +++ b/src/plugins/cpptools/builtinindexingsupport.cpp @@ -163,7 +163,8 @@ BuiltinIndexingSupport::BuiltinIndexingSupport() BuiltinIndexingSupport::~BuiltinIndexingSupport() {} -QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sourceFiles) +QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sourceFiles, + CppModelManagerInterface::ProgressNotificationMode mode) { CppModelManager *mgr = CppModelManager::instance(); const WorkingCopy workingCopy = mgr->workingCopy(); @@ -189,7 +190,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sour m_synchronizer.addFuture(result); - if (sourceFiles.count() > 1) { + if (mode == CppModelManagerInterface::ForcedProgressNotification || sourceFiles.count() > 1) { Core::ICore::progressManager()->addTask(result, QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing"), QLatin1String(CppTools::Constants::TASK_INDEX)); diff --git a/src/plugins/cpptools/builtinindexingsupport.h b/src/plugins/cpptools/builtinindexingsupport.h index 53b70c40dbc98474b0313e78da75e56ace0f8b17..df4a9c91084c88616c1044ff2289e2d087744d65 100644 --- a/src/plugins/cpptools/builtinindexingsupport.h +++ b/src/plugins/cpptools/builtinindexingsupport.h @@ -46,8 +46,10 @@ public: BuiltinIndexingSupport(); ~BuiltinIndexingSupport(); - virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles); - virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames); + virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles, + CppModelManagerInterface::ProgressNotificationMode mode); + virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, + QSet<QString> fileNames); private: QFutureSynchronizer<void> m_synchronizer; diff --git a/src/plugins/cpptools/cppindexingsupport.h b/src/plugins/cpptools/cppindexingsupport.h index d6cf2121fcadfdda3a6ada02c383d8cf622bb5ca..c2b91817a39b6ee7811ca32a881ba3dbdd104fce 100644 --- a/src/plugins/cpptools/cppindexingsupport.h +++ b/src/plugins/cpptools/cppindexingsupport.h @@ -32,6 +32,8 @@ #include "cpptools_global.h" +#include "cppmodelmanagerinterface.h" + #include <find/searchresultwindow.h> #include <find/textfindconstants.h> @@ -80,8 +82,10 @@ class CPPTOOLS_EXPORT CppIndexingSupport public: virtual ~CppIndexingSupport() = 0; - virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles) = 0; - virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet<QString> fileNames) = 0; + virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles, + CppModelManagerInterface::ProgressNotificationMode mode) = 0; + virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, + QSet<QString> fileNames) = 0; }; } // namespace CppTools diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 1952cdd70ac2b8b8c968ea03cd29880afb431822..b26bb706e63c9555d20c6ed3a6dadeae8fc40571 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -522,14 +522,15 @@ CppModelManager::WorkingCopy CppModelManager::workingCopy() const return const_cast<CppModelManager *>(this)->buildWorkingCopyList(); } -QFuture<void> CppModelManager::updateSourceFiles(const QStringList &sourceFiles) +QFuture<void> CppModelManager::updateSourceFiles(const QStringList &sourceFiles, + ProgressNotificationMode mode) { if (sourceFiles.isEmpty() || !m_indexerEnabled) return QFuture<void>(); if (m_indexingSupporter) - m_indexingSupporter->refreshSourceFiles(sourceFiles); - return m_internalIndexingSupport->refreshSourceFiles(sourceFiles); + m_indexingSupporter->refreshSourceFiles(sourceFiles, mode); + return m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode); } QList<CppModelManager::ProjectInfo> CppModelManager::projectInfos() const diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 7691daeab328c1ce8307336b0809234eee98c669..8e51b5e373df634d98bb0108622c14757708aaab 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -67,7 +67,8 @@ public: static CppModelManager *instance(); - virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles); + virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles, + ProgressNotificationMode mode = ReservedProgressNotification); virtual WorkingCopy workingCopy() const; virtual QList<ProjectInfo> projectInfos() const; diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.cpp b/src/plugins/cpptools/cppmodelmanagerinterface.cpp index c6b535d98d94a8bb71d7c811bd63cc4986d49ff6..d3e34ca3202392041b28203c5f227c43d18715b0 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.cpp +++ b/src/plugins/cpptools/cppmodelmanagerinterface.cpp @@ -35,6 +35,20 @@ #include <QtCore/QSet> +/*! + \enum CppTools::CppModelManagerInterface::ProgressNotificationMode + + This enum type specifies whether a progress bar notification should be + shown if more than one file is requested to update via + CppModelManagerInterface::updateSourceFiles(). + + \value ForcedProgressNotification + Notify regardless of the number of files requested for update. + + \value ReservedProgressNotification + Notify only if more than one file is requested for update. +*/ + /*! \enum CppTools::CppModelManagerInterface::QtVersion Allows C++ parser engine to inject headers or change inner settings as diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index 4e9adf22471224928516677215024aa169bcd85f..f9d299b937768edd669be11faf339491404ae4f7 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -117,6 +117,12 @@ class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject public: + // Documented in source file. + enum ProgressNotificationMode { + ForcedProgressNotification, + ReservedProgressNotification + }; + class CPPTOOLS_EXPORT ProjectInfo { public: @@ -251,8 +257,10 @@ Q_SIGNALS: void projectPartsUpdated(ProjectExplorer::Project *project); public Q_SLOTS: + virtual void updateModifiedSourceFiles() = 0; - virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles) = 0; + virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles, + ProgressNotificationMode mode = ReservedProgressNotification) = 0; virtual void GC() = 0; };