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

@@ -258,20 +258,6 @@ QMap<Core::Id, QVariantMap> RunConfiguration::aspectData() const
return data;
}
bool RunConfiguration::isConfigured() const
{
return true;
}
RunConfiguration::ConfigurationState RunConfiguration::ensureConfigured(QString *errorMessage)
{
if (isConfigured())
return Configured;
if (errorMessage)
*errorMessage = tr("Unknown error.");
return UnConfigured;
}
BuildConfiguration *RunConfiguration::activeBuildConfiguration() const
{
return target()->activeBuildConfiguration();
@@ -287,6 +273,11 @@ void RunConfiguration::setUpdater(const Updater &updater)
m_updater = updater;
}
Task RunConfiguration::createConfigurationIssue(const QString &description) const
{
return {Task::Error, description, FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM};
}
QVariantMap RunConfiguration::toMap() const
{
QVariantMap map = ProjectConfiguration::toMap();