ProjectExplorer: Rework RunConfiguration::isConfigured()

The old code had a number of problems:
    - There was one function isConfigured() to report whether the
      run config has issues, and a second one, ensureConfigured(),
      needed to be called to retrieve the details. At least one subclass
      implementor forgot to re-implement the first one, so the second
      one was never called.
    - The ensureConfigured() function could show a dialog and thereby
      delay execution of the run configuration, leading to additional
      state and a more complicated execution logic. Also, the dialog
      duplicated the run configuration UI.

We now have only one function returning a list of Task objects. If the
list is not empty, we present them to the user in a non-blocking way and
abort the execution.

Change-Id: I5f2a8126a2c1bd2ca51345b9e37b979bfc0c0b98
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-12-05 16:28:52 +01:00
parent 85b7833a3e
commit cf9249a905
12 changed files with 59 additions and 278 deletions

View File

@@ -100,17 +100,14 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Core::Id id)
setDefaultDisplayName(tr("Run on Boot2Qt Device"));
}
ProjectExplorer::RunConfiguration::ConfigurationState QdbRunConfiguration::ensureConfigured(QString *errorMessage)
Tasks QdbRunConfiguration::checkForIssues() const
{
QString remoteExecutable = aspect<ExecutableAspect>()->executable().toString();
if (remoteExecutable.isEmpty()) {
if (errorMessage) {
*errorMessage = tr("The remote executable must be set "
"in order to run on a Boot2Qt device.");
}
return UnConfigured;
Tasks tasks;
if (aspect<ExecutableAspect>()->executable().toString().isEmpty()) {
tasks << createConfigurationIssue(tr("The remote executable must be set "
"in order to run on a Boot2Qt device."));
}
return Configured;
return tasks;
}
QString QdbRunConfiguration::defaultDisplayName() const