diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-12-05 16:28:52 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-12-05 16:35:48 +0000 |
commit | cf9249a905a6aa7bec904fc51b9ee7d9ad39dd06 (patch) | |
tree | a8873cf7e9f864d44d97cab7ef62c62907ac4623 /src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp | |
parent | 85b7833a3e15c83598010f4fd807d29fa847dcb6 (diff) |
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>
Diffstat (limited to 'src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp')
-rw-r--r-- | src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index d43cc7a9f1b..32db508f8a7 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -68,24 +68,6 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar setDefaultDisplayName(runConfigDefaultDisplayName()); } -bool RemoteLinuxCustomRunConfiguration::isConfigured() const -{ - return !aspect<ExecutableAspect>()->executable().isEmpty(); -} - -RunConfiguration::ConfigurationState -RemoteLinuxCustomRunConfiguration::ensureConfigured(QString *errorMessage) -{ - if (!isConfigured()) { - if (errorMessage) { - *errorMessage = tr("The remote executable must be set " - "in order to run a custom remote run configuration."); - } - return UnConfigured; - } - return Configured; -} - Core::Id RemoteLinuxCustomRunConfiguration::runConfigId() { return "RemoteLinux.CustomRunConfig"; @@ -107,6 +89,16 @@ Runnable RemoteLinuxCustomRunConfiguration::runnable() const return r; } +Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const +{ + Tasks tasks; + if (aspect<ExecutableAspect>()->executable().isEmpty()) { + tasks << createConfigurationIssue(tr("The remote executable must be set in order to run " + "a custom remote run configuration.")); + } + return tasks; +} + // RemoteLinuxCustomRunConfigurationFactory RemoteLinuxCustomRunConfigurationFactory::RemoteLinuxCustomRunConfigurationFactory() |