summaryrefslogtreecommitdiff
path: root/src/plugins/ios/iosdeploystep.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-01-25 14:26:34 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2019-01-31 16:10:01 +0000
commit966f4ea6a9d1e46833fc30df878ba6fa8f919988 (patch)
tree7f37c2adcf4dd6fe002585fb3b3c2815b21c5f26 /src/plugins/ios/iosdeploystep.cpp
parent536618b012b44b5ced428fc39600931803d5dd44 (diff)
downloadqt-creator-966f4ea6a9d1e46833fc30df878ba6fa8f919988.tar.gz
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated thread. Communication between the step and the manager happened via a QFutureInterface that was passed into the step's run() function. Later, new steps were added that operated asynchronously, so the build manager had to differentiate between the different kinds of steps for starting and stopping. These days, almost all build and deploy steps work asynchronously, which made the QFuture-based interface look increasingly odd. With this patch, all build steps are expected to work asynchronously, so the build manager no longer needs to differentiate. Steps are started and requested to stop via the run() and cancel() functions, respectively, and emit the finished() signal when they are done. Build step implementors no longer have to deal with a QFutureInterface. For steps whose implementation is inherently synchronous, the BuildStep base class offers a runInThread() function. Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/ios/iosdeploystep.cpp')
-rw-r--r--src/plugins/ios/iosdeploystep.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/plugins/ios/iosdeploystep.cpp b/src/plugins/ios/iosdeploystep.cpp
index ff9e376cfe..65a225e7e6 100644
--- a/src/plugins/ios/iosdeploystep.cpp
+++ b/src/plugins/ios/iosdeploystep.cpp
@@ -58,7 +58,6 @@ IosDeployStep::IosDeployStep(BuildStepList *parent)
: BuildStep(parent, stepId())
{
setImmutable(true);
- setRunInGuiThread(true);
updateDisplayNames();
connect(DeviceManager::instance(), &DeviceManager::updated,
this, &IosDeployStep::updateDisplayNames);
@@ -101,22 +100,19 @@ bool IosDeployStep::init()
return true;
}
-void IosDeployStep::run(QFutureInterface<bool> &fi)
+void IosDeployStep::doRun()
{
- m_futureInterface = fi;
QTC_CHECK(m_transferStatus == NoTransfer);
if (device().isNull()) {
TaskHub::addTask(Task::Error, tr("Deployment failed. No iOS device found."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
- reportRunResult(m_futureInterface, !iossimulator().isNull());
+ emit finished(!iossimulator().isNull());
cleanup();
return;
}
m_toolHandler = new IosToolHandler(m_deviceType, this);
m_transferStatus = TransferInProgress;
- m_futureInterface.setProgressRange(0, 200);
- m_futureInterface.setProgressValueAndText(0, QLatin1String("Transferring application"));
- m_futureInterface.reportStarted();
+ emit progress(0, tr("Transferring application"));
connect(m_toolHandler, &IosToolHandler::isTransferringApp,
this, &IosDeployStep::handleIsTransferringApp);
connect(m_toolHandler, &IosToolHandler::didTransferApp,
@@ -129,7 +125,7 @@ void IosDeployStep::run(QFutureInterface<bool> &fi)
m_toolHandler->requestTransferApp(appBundle(), m_deviceType.identifier);
}
-void IosDeployStep::cancel()
+void IosDeployStep::doCancel()
{
if (m_toolHandler)
m_toolHandler->stop();
@@ -150,8 +146,7 @@ void IosDeployStep::handleIsTransferringApp(IosToolHandler *handler, const QStri
{
Q_UNUSED(handler); Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
QTC_CHECK(m_transferStatus == TransferInProgress);
- m_futureInterface.setProgressRange(0, maxProgress);
- m_futureInterface.setProgressValueAndText(progress, info);
+ emit this->progress(progress * 100 / maxProgress, info);
}
void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString &bundlePath,
@@ -168,7 +163,7 @@ void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString
tr("Deployment failed. The settings in the Devices window of Xcode might be incorrect."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
}
- reportRunResult(m_futureInterface, status == IosToolHandler::Success);
+ emit finished(status == IosToolHandler::Success);
}
void IosDeployStep::handleFinished(IosToolHandler *handler)
@@ -178,7 +173,7 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
m_transferStatus = TransferFailed;
TaskHub::addTask(Task::Error, tr("Deployment failed."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
- reportRunResult(m_futureInterface, false);
+ emit finished(false);
break;
case NoTransfer:
case TransferOk: