Commit 26fbefb2 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools: Allow to force a "Parsing" notification

Task-number: QTCREATORBUG-9597

Change-Id: I726a818c7d4af35dcb4863f74b08cd639a189bdd
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 174874f5
......@@ -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));
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment