diff options
author | hjk <hjk@qt.io> | 2017-09-01 13:23:02 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-09-13 09:24:26 +0000 |
commit | 890c1906e6fb2eceb3eaf381b0c298138be3a932 (patch) | |
tree | b8497216ea125ac47621451082202a25000206e7 /src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp | |
parent | 4710e6b4b2df67a9d483c33e1a2b06a4139f7baa (diff) |
ProjectExplorer: Re-organize RunConfiguration constructors
The idea is to massage the setup in a way to make implementation
of new configurations less error prone by identifying recurring patterns
and sharing repetitive code that tends to be forgotten (see Android cloning).
The former two lines of constructors (owner-and-id, owner-and-source)
are split into a simple, shared, constructor and new setId() and
copyFrom() functions.
The change is mostly mechanical, some multiple calls to fromMap
have been removed, though, some consts added.
Otherwise, to keep the patch small it temporarily introduces two
helper templates in IRunConfigurationFactory. Also, setId() signatures
have not been unified yet. These won't be needed in the final setup.
Change-Id: I8c0734496caae744a9883fe6d92c1d8f8e0234ea
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp')
-rw-r--r-- | src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 1f0b9fc2102..7ae8d9b9fad 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -96,21 +96,29 @@ private: Ui::RemoteLinuxCustomRunConfigurationWidget m_ui; }; -RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent) - : RunConfiguration(parent, runConfigId()) +RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *target) + : RunConfiguration(target) { - init(); + addExtraAspect(new RemoteLinuxEnvironmentAspect(this)); } -RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent, - RemoteLinuxCustomRunConfiguration *source) - : RunConfiguration(parent, source) - , m_localExecutable(source->m_localExecutable) - , m_remoteExecutable(source->m_remoteExecutable) - , m_arguments(source->m_arguments) - , m_workingDirectory(source->m_workingDirectory) +void RemoteLinuxCustomRunConfiguration::initialize() { - init(); + RunConfiguration::initialize(runConfigId()); + + setDefaultDisplayName(runConfigDefaultDisplayName()); +} + +void RemoteLinuxCustomRunConfiguration::copyFrom(const RemoteLinuxCustomRunConfiguration *source) +{ + RunConfiguration::copyFrom(source); + + m_localExecutable = source->m_localExecutable; + m_remoteExecutable = source->m_remoteExecutable; + m_arguments = source->m_arguments; + m_workingDirectory = source->m_workingDirectory; + + setDefaultDisplayName(runConfigDefaultDisplayName()); } bool RemoteLinuxCustomRunConfiguration::isConfigured() const @@ -167,12 +175,6 @@ QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName() return tr("Custom Executable (on Remote Generic Linux Host)"); } -void RemoteLinuxCustomRunConfiguration::init() -{ - setDefaultDisplayName(runConfigDefaultDisplayName()); - addExtraAspect(new RemoteLinuxEnvironmentAspect(this)); -} - static QString localExeKey() { return QLatin1String("RemoteLinux.CustomRunConfig.LocalExecutable"); |