diff options
author | hjk <[email protected]> | 2017-09-01 13:23:02 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2017-09-13 09:24:26 +0000 |
commit | 890c1906e6fb2eceb3eaf381b0c298138be3a932 (patch) | |
tree | b8497216ea125ac47621451082202a25000206e7 /src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h | |
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 <[email protected]>
Diffstat (limited to 'src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h')
-rw-r--r-- | src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h index d55eb280998..0dcdf19a59a 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h @@ -40,20 +40,17 @@ namespace QtSupport { class BaseQtVersion; } namespace QmlProjectManager { class QmlProject; -namespace Internal { - class QmlProjectRunConfigurationFactory; - class QmlProjectRunConfigurationWidget; -} +namespace Internal { class QmlProjectRunConfigurationWidget; } class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration { Q_OBJECT - friend class Internal::QmlProjectRunConfigurationFactory; + friend class ProjectExplorer::IRunConfigurationFactory; friend class Internal::QmlProjectRunConfigurationWidget; friend class QmlProject; // to call updateEnabled() public: - QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id); + explicit QmlProjectRunConfiguration(ProjectExplorer::Target *target); ProjectExplorer::Runnable runnable() const override; @@ -79,13 +76,10 @@ public: signals: void scriptSourceChanged(); -protected: - QmlProjectRunConfiguration(ProjectExplorer::Target *parent, - QmlProjectRunConfiguration *source); - virtual bool fromMap(const QVariantMap &map) override; - private: - void ctor(); + void initialize(Core::Id id); + void copyFrom(const QmlProjectRunConfiguration *source); + virtual bool fromMap(const QVariantMap &map) override; void changeCurrentFile(Core::IEditor* = 0); void updateEnabledState() final; |