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>
This commit is contained in:
hjk
2017-09-01 13:23:02 +02:00
parent 4710e6b4b2
commit 890c1906e6
52 changed files with 510 additions and 506 deletions

View File

@@ -29,17 +29,13 @@
#include <projectexplorer/runconfiguration.h>
QT_BEGIN_NAMESPACE
class QToolButton;
QT_END_NAMESPACE
namespace Android {
class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
public:
AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
explicit AndroidRunConfiguration(ProjectExplorer::Target *target);
QWidget *createConfigurationWidget() override;
Utils::OutputFormatter *createOutputFormatter() const override;
@@ -51,15 +47,12 @@ public:
const QStringList &preStartShellCommands() const;
const QStringList &postFinishShellCommands() const;
protected:
AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
private:
// FIXME: This appears to miss a copyFrom() implementation.
void setPreStartShellCommands(const QStringList &cmdList);
void setPostFinishShellCommands(const QStringList &cmdList);
void setAmStartExtraArgs(const QStringList &args);
private:
QStringList m_amStartExtraArgs;
QStringList m_preStartShellCommands;
QStringList m_postFinishShellCommands;