Commit 1936535c authored by con's avatar con
Browse files

Show a more sensible progress bar for building debug helper.

parent 09cd063c
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <utils/treewidgetcolumnstretcher.h> #include <utils/treewidgetcolumnstretcher.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <qtconcurrent/runextensions.h>
#include <QtCore/QFuture> #include <QtCore/QFuture>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
...@@ -33,9 +34,12 @@ DebuggingHelperBuildTask::~DebuggingHelperBuildTask() ...@@ -33,9 +34,12 @@ DebuggingHelperBuildTask::~DebuggingHelperBuildTask()
{ {
} }
void DebuggingHelperBuildTask::run() void DebuggingHelperBuildTask::run(QFutureInterface<void> &future)
{ {
future.setProgressRange(0, 4);
future.setProgressValue(1);
const QString output = m_version->buildDebuggingHelperLibrary(); const QString output = m_version->buildDebuggingHelperLibrary();
future.setProgressValue(1);
emit finished(m_version->name(), output); emit finished(m_version->name(), output);
deleteLater(); deleteLater();
} }
...@@ -249,7 +253,7 @@ void QtOptionsPageWidget::buildDebuggingHelper() ...@@ -249,7 +253,7 @@ void QtOptionsPageWidget::buildDebuggingHelper()
DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(m_versions.at(index)); DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(m_versions.at(index));
connect(buildTask, SIGNAL(finished(QString,QString)), this, SLOT(debuggingHelperBuildFinished(QString,QString)), connect(buildTask, SIGNAL(finished(QString,QString)), this, SLOT(debuggingHelperBuildFinished(QString,QString)),
Qt::QueuedConnection); Qt::QueuedConnection);
QFuture<void> task = QtConcurrent::run(buildTask, &DebuggingHelperBuildTask::run); QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
const QString taskName = tr("Building helpers"); const QString taskName = tr("Building helpers");
Core::ICore::instance()->progressManager()->addTask(task, taskName, Core::ICore::instance()->progressManager()->addTask(task, taskName,
QLatin1String("Qt4ProjectManager::BuildHelpers"), QLatin1String("Qt4ProjectManager::BuildHelpers"),
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QSharedPointer> #include <QtCore/QSharedPointer>
#include <QtCore/QFutureInterface>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
...@@ -61,7 +62,7 @@ public: ...@@ -61,7 +62,7 @@ public:
explicit DebuggingHelperBuildTask(const QSharedPointerQtVersion &version); explicit DebuggingHelperBuildTask(const QSharedPointerQtVersion &version);
virtual ~DebuggingHelperBuildTask(); virtual ~DebuggingHelperBuildTask();
void run(); void run(QFutureInterface<void> &future);
signals: signals:
void finished(const QString &versionName, const QString &output); void finished(const QString &versionName, const QString &output);
......
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