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 <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-08-18 08:49:16 +02:00
parent 98c48a4779
commit db005bf5eb

View File

@@ -45,6 +45,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
#include <QDir>
#include <QPushButton>
@@ -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.") + "<p>" + 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)