From db005bf5eb269d621b5ead1fb38ae993c7f91713 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 18 Aug 2017 08:49:16 +0200 Subject: [PATCH] ProjectExplorer: Workaround for displaying startup failures Failures during RunControl construction currently get not to the user as the Application output pane is not yet available. In theory it should not happen, rather the condition should be checked to disable running entirely, but in practice it can happen e.g. in the BareMetal setup right now. To avoid pre-release code restructuring, force a message box in such cases. Change-Id: I703c47b270d153afff34e08dad7833540a5983a2 Reviewed-by: Christian Kandeler --- .../projectexplorer/runconfiguration.cpp | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 9ab4421ff4b..e70f93a707e 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -922,10 +923,29 @@ void RunControlPrivate::onWorkerFailed(RunWorker *worker, const QString &msg) worker->d->state = RunWorkerState::Done; showError(msg); - if (state == RunControlState::Running || state == RunControlState::Starting) - initiateStop(); - else + switch (state) { + case RunControlState::Initialized: + // FIXME 1: We don't have an output pane yet, so use some other mechanism for now. + // FIXME 2: Translation... + QMessageBox::critical(Core::ICore::dialogParent(), + QCoreApplication::translate("TaskHub", "Error"), + QString("Failure during startup. Aborting.") + "

" + msg); continueStopOrFinish(); + break; + case RunControlState::Starting: + case RunControlState::Running: + initiateStop(); + break; + case RunControlState::Stopping: + case RunControlState::Finishing: + continueStopOrFinish(); + break; + case RunControlState::Stopped: + case RunControlState::Finished: + QTC_CHECK(false); // Should not happen. + continueStopOrFinish(); + break; + } } void RunControlPrivate::onWorkerStopped(RunWorker *worker)