Commit 98917598 authored by hjk's avatar hjk
Browse files

ProjectManager: Use Core::Id for progress types



Change-Id: I72993fda50ad70ad2d7c2f449923ac6e34b9e737
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 1f340d44
......@@ -168,7 +168,7 @@ void FetchContext::start()
{
m_progress.setProgressRange(0, 2);
FutureProgress *fp = ProgressManager::addTask(m_progress.future(), tr("Gerrit Fetch"),
QLatin1String("gerrit-fetch"));
"gerrit-fetch");
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
m_progress.reportStarted();
// Order: initialize future before starting the process in case error handling is invoked.
......
......@@ -194,8 +194,7 @@ void SearchWidget::indexingStarted()
{
Q_ASSERT(!m_progress);
m_progress = new QFutureInterface<void>();
Core::ProgressManager::addTask(m_progress->future(),
tr("Indexing"), QLatin1String("Help.Indexer"));
Core::ProgressManager::addTask(m_progress->future(), tr("Indexing"), "Help.Indexer");
m_progress->setProgressRange(0, 2);
m_progress->setProgressValueAndText(1, tr("Indexing Documentation..."));
m_progress->reportStarted();
......
......@@ -261,7 +261,7 @@ void LocatorPlugin::refresh(QList<ILocatorFilter *> filters)
filters = m_filters;
QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters);
FutureProgress *progress =
ProgressManager::addTask(task, tr("Indexing"), QLatin1String(Locator::Constants::TASK_INDEX));
ProgressManager::addTask(task, tr("Indexing"), Locator::Constants::TASK_INDEX);
connect(progress, SIGNAL(finished()), this, SLOT(saveSettings()));
}
......
......@@ -300,8 +300,7 @@ void BuildManager::startBuildQueue(const QStringList &preambleMessage)
TaskHub::clearTasks(Constants::TASK_CATEGORY_DEPLOYMENT);
ProgressManager::setApplicationLabel(QString());
d->m_futureProgress = ProgressManager::addTask(d->m_progressFutureInterface->future(),
QString(),
QLatin1String(Constants::TASK_BUILD),
QString(), "ProjectExplorer.Task.Build",
ProgressManager::KeepOnFinish | ProgressManager::ShowInApplicationIcon);
connect(d->m_futureProgress.data(), SIGNAL(clicked()), this, SLOT(showBuildResults()));
d->m_futureProgress.data()->setWidget(new Internal::BuildProgress(d->m_taskWindow));
......
......@@ -162,8 +162,6 @@ const char ICON_STOP[] = ":/projectexplorer/images/stop.png";
const char ICON_STOP_SMALL[] = ":/projectexplorer/images/stop_small.png";
const char ICON_WINDOW[] = ":/projectexplorer/images/window.png";
const char TASK_BUILD[] = "ProjectExplorer.Task.Build";
// Mime types
const char C_SOURCE_MIMETYPE[] = "text/x-csrc";
const char C_HEADER_MIMETYPE[] = "text/x-chdr";
......
......@@ -857,7 +857,7 @@ bool SessionManager::loadSession(const QString &session)
m_virginSession = false;
ProgressManager::addTask(m_future.future(), tr("Session"),
QLatin1String("ProjectExplorer.SessionFile.Load"));
"ProjectExplorer.SessionFile.Load");
m_future.setProgressRange(0, 1);
m_future.setProgressValue(0);
......
......@@ -467,8 +467,8 @@ void QbsProject::prepareForParsing()
m_currentProgressBase = 0;
m_qbsUpdateFutureInterface = new QFutureInterface<void>();
m_qbsUpdateFutureInterface->setProgressRange(0, 0);
ProgressManager::addTask(m_qbsUpdateFutureInterface->future(), tr("Evaluating"),
QLatin1String(Constants::QBS_EVALUATE));
ProgressManager::addTask(m_qbsUpdateFutureInterface->future(),
tr("Evaluating"), "Qbs.QbsEvaluate");
m_qbsUpdateFutureInterface->reportStarted();
}
......
......@@ -41,9 +41,6 @@ const char PROJECT_ID[] = "Qbs.QbsProject";
// MIME types:
const char MIME_TYPE[] = "application/x-qt.qbs+qml";
// Progress reports:
const char QBS_EVALUATE[] = "Qbs.QbsEvaluate";
// Actions:
const char ACTION_REPARSE_QBS[] = "Qbs.Reparse";
const char ACTION_REPARSE_QBS_CONTEXT[] = "Qbs.ReparseCtx";
......
......@@ -942,7 +942,7 @@ void FindReferences::displayResults(int first, int last)
FutureProgress *progress = ProgressManager::addTask(
m_watcher.future(), tr("Searching"),
QLatin1String(QmlJSEditor::Constants::TASK_SEARCH));
QmlJSEditor::Constants::TASK_SEARCH);
connect(progress, SIGNAL(clicked()), m_currentSearch, SLOT(popup()));
++first;
......
......@@ -380,8 +380,7 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles,
m_synchronizer.addFuture(result);
if (sourceFiles.count() > 1) {
ProgressManager::addTask(result, tr("Indexing"),
QLatin1String(Constants::TASK_INDEX));
ProgressManager::addTask(result, tr("Indexing"), Constants::TASK_INDEX);
}
return result;
......
......@@ -112,10 +112,10 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
mqmljstools->addAction(cmd);
// watch task progress
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
this, SLOT(onTaskStarted(QString)));
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
this, SLOT(onAllTasksFinished(QString)));
connect(ProgressManager::instance(), SIGNAL(taskStarted(Core::Id)),
this, SLOT(onTaskStarted(Core::Id)));
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(Core::Id)),
this, SLOT(onAllTasksFinished(Core::Id)));
return true;
}
......@@ -130,15 +130,15 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSToolsPlugin::aboutToShutdown()
return SynchronousShutdown;
}
void QmlJSToolsPlugin::onTaskStarted(const QString &type)
void QmlJSToolsPlugin::onTaskStarted(Core::Id type)
{
if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX))
if (type == QmlJSTools::Constants::TASK_INDEX)
m_resetCodeModelAction->setEnabled(false);
}
void QmlJSToolsPlugin::onAllTasksFinished(const QString &type)
void QmlJSToolsPlugin::onAllTasksFinished(Core::Id type)
{
if (type == QLatin1String(QmlJSTools::Constants::TASK_INDEX))
if (type == QmlJSTools::Constants::TASK_INDEX)
m_resetCodeModelAction->setEnabled(true);
}
......
......@@ -30,6 +30,7 @@
#ifndef QMLJSTOOLS_H
#define QMLJSTOOLS_H
#include <coreplugin/id.h>
#include <extensionsystem/iplugin.h>
QT_BEGIN_NAMESPACE
......@@ -64,8 +65,8 @@ public:
ModelManager *modelManager() { return m_modelManager; }
private slots:
void onTaskStarted(const QString &type);
void onAllTasksFinished(const QString &type);
void onTaskStarted(Core::Id type);
void onAllTasksFinished(Core::Id type);
#ifdef WITH_TESTS
void test_basic();
......
......@@ -859,7 +859,7 @@ void Qt4Project::asyncUpdate()
m_asyncUpdateFutureInterface->setProgressRange(0, 0);
Core::ProgressManager::addTask(m_asyncUpdateFutureInterface->future(), tr("Evaluating"),
QLatin1String(Constants::PROFILE_EVALUATE));
Constants::PROFILE_EVALUATE);
if (debug)
qDebug()<<" adding task";
......
......@@ -1517,7 +1517,7 @@ void BaseQtVersion::buildDebuggingHelper(ToolChain *tc, int tools)
QFuture<void> task = QtConcurrent::run(&QtSupport::DebuggingHelperBuildTask::run, buildTask);
const QString taskName = QCoreApplication::translate("BaseQtVersion", "Building helpers");
ProgressManager::addTask(task, taskName, QLatin1String("Qt::BuildHelpers"));
ProgressManager::addTask(task, taskName, "Qt::BuildHelpers");
}
FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
......
......@@ -327,7 +327,7 @@ void QmlDumpTool::pathAndEnvironment(Project *project, BaseQtVersion *version,
buildTask->updateProjectWhenDone(project, preferDebug);
QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask);
const QString taskName = QmlDumpBuildTask::tr("Building helper");
Core::ProgressManager::addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers"));
Core::ProgressManager::addTask(task, taskName, "Qt4ProjectManager::BuildHelpers");
}
return;
}
......
......@@ -458,7 +458,7 @@ void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools t
QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
const QString taskName = tr("Building helpers");
Core::ProgressManager::addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers"));
Core::ProgressManager::addTask(task, taskName, "Qt4ProjectManager::BuildHelpers");
}
void QtOptionsPageWidget::buildGdbHelper()
{
......
......@@ -181,8 +181,9 @@ void BaseFileFind::runSearch(Find::SearchResult *search)
textDocumentFlagsForFindFlags(parameters.flags),
ITextEditor::openedTextDocumentContents()));
}
FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Search"),
QLatin1String(Constants::TASK_SEARCH)); progress->setWidget(label);
FutureProgress *progress =
ProgressManager::addTask(watcher->future(), tr("Search"), Constants::TASK_SEARCH);
progress->setWidget(label);
progress->setStatusBarWidget(statusLabel);
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
}
......
......@@ -367,8 +367,7 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const
} else {
QFutureInterface<void> interface;
interface.setProgressRange(0, chunks);
ProgressManager::addTask(interface.future(),
tr("Opening file"), QLatin1String(Constants::TASK_OPEN_FILE));
ProgressManager::addTask(interface.future(), tr("Opening file"), Constants::TASK_OPEN_FILE);
interface.reportStarted();
d->m_document->setUndoRedoEnabled(false);
QTextCursor c(d->m_document);
......
......@@ -310,8 +310,7 @@ void Manager::registerMimeTypes()
connect(&m_registeringWatcher, SIGNAL(finished()), processor, SLOT(deleteLater()));
m_registeringWatcher.setFuture(future);
ProgressManager::addTask(future, tr("Registering definitions"),
QLatin1String(Constants::TASK_REGISTER_DEFINITIONS));
ProgressManager::addTask(future, tr("Registering definitions"), "TextEditor.Task.Register");
} else {
m_hasQueuedRegistration = true;
m_registeringWatcher.cancel();
......@@ -444,8 +443,7 @@ void Manager::downloadDefinitions(const QList<QUrl> &urls, const QString &savePa
m_isDownloadingDefinitionsSpec = true;
QFuture<void> future = QtConcurrent::map(m_downloaders, DownloaderStarter());
m_downloadWatcher.setFuture(future);
ProgressManager::addTask(future, tr("Downloading definitions"),
QLatin1String(Constants::TASK_DOWNLOAD_DEFINITIONS));
ProgressManager::addTask(future, tr("Downloading definitions"), "TextEditor.Task.Download");
}
void Manager::downloadDefinitionsFinished()
......
......@@ -159,8 +159,6 @@ const char GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION[] = "TextEditor.GotoPrev
const char GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION[] = "TextEditor.GotoNextWordCamelCaseWithSelection";
const char C_TEXTEDITOR_MIMETYPE_TEXT[] = "text/plain";
const char INFO_SYNTAX_DEFINITION[] = "TextEditor.InfoSyntaxDefinition";
const char TASK_DOWNLOAD_DEFINITIONS[] = "TextEditor.Task.Download";
const char TASK_REGISTER_DEFINITIONS[] = "TextEditor.Task.Register";
const char TASK_OPEN_FILE[] = "TextEditor.Task.OpenFile";
const char CIRCULAR_PASTE[] = "TextEditor.CircularPaste";
const char SWITCH_UTF8BOM[] = "TextEditor.SwitchUtf8bom";
......
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