forked from qt-creator/qt-creator
Enhance IRunConfigurationAspect base interface
Move some commonly used functions to the base, The plan is to identify aspects by Id instead of type more often, so avoid casts proactively. Change-Id: I1b94b858a4491a0e31cedc788ded643a82242b2a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -155,6 +155,11 @@ void IRunConfigurationAspect::toMap(QVariantMap &map) const
|
||||
map.insert(m_id.toString() + QLatin1String(".UseGlobalSettings"), m_useGlobalSettings);
|
||||
}
|
||||
|
||||
void IRunConfigurationAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
Q_UNUSED(layout);
|
||||
}
|
||||
|
||||
void IRunConfigurationAspect::setRunConfigWidgetCreator(const RunConfigWidgetCreator &runConfigWidgetCreator)
|
||||
{
|
||||
m_runConfigWidgetCreator = runConfigWidgetCreator;
|
||||
|
||||
@@ -134,6 +134,11 @@ public:
|
||||
ISettingsAspect *currentSettings() const;
|
||||
RunConfiguration *runConfiguration() const { return m_runConfiguration; }
|
||||
|
||||
virtual void addToConfigurationLayout(QFormLayout *layout);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
friend class RunConfiguration;
|
||||
virtual void fromMap(const QVariantMap &map);
|
||||
|
||||
@@ -68,7 +68,7 @@ void TerminalAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
connect(m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
|
||||
m_userSet = true;
|
||||
m_useTerminal = m_checkBox->isChecked();
|
||||
emit useTerminalChanged(m_useTerminal);
|
||||
emit changed();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ void TerminalAspect::setUseTerminal(bool useTerminal)
|
||||
{
|
||||
if (m_useTerminal != useTerminal) {
|
||||
m_useTerminal = useTerminal;
|
||||
emit useTerminalChanged(useTerminal);
|
||||
emit changed();
|
||||
}
|
||||
if (m_checkBox)
|
||||
m_checkBox->setChecked(m_useTerminal);
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
TerminalAspect(RunConfiguration *rc, const QString &settingsKey,
|
||||
bool useTerminal = false);
|
||||
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
|
||||
bool useTerminal() const;
|
||||
void setUseTerminal(bool useTerminal);
|
||||
@@ -60,9 +60,6 @@ public:
|
||||
|
||||
bool isUserSet() const;
|
||||
|
||||
signals:
|
||||
void useTerminalChanged(bool);
|
||||
|
||||
private:
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
@@ -80,7 +77,7 @@ public:
|
||||
explicit WorkingDirectoryAspect(RunConfiguration *runConfig,
|
||||
const QString &settingsKey = QString());
|
||||
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
|
||||
Utils::FileName workingDirectory() const;
|
||||
Utils::FileName defaultWorkingDirectory() const;
|
||||
@@ -108,7 +105,7 @@ class PROJECTEXPLORER_EXPORT ArgumentsAspect : public IRunConfigurationAspect
|
||||
public:
|
||||
explicit ArgumentsAspect(RunConfiguration *runConfig, const QString &settingsKey = QString());
|
||||
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
|
||||
QString arguments() const;
|
||||
QString unexpandedArguments() const;
|
||||
@@ -134,7 +131,7 @@ public:
|
||||
explicit BaseBoolAspect(RunConfiguration *rc, const QString &settingsKey = QString());
|
||||
~BaseBoolAspect() override;
|
||||
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
|
||||
bool value() const;
|
||||
void setValue(bool val);
|
||||
@@ -144,9 +141,6 @@ public:
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
bool m_value = false;
|
||||
QString m_label;
|
||||
@@ -177,7 +171,7 @@ public:
|
||||
explicit BaseStringAspect(RunConfiguration *rc);
|
||||
~BaseStringAspect() override;
|
||||
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
|
||||
QString value() const;
|
||||
void setValue(const QString &val);
|
||||
@@ -203,9 +197,6 @@ public:
|
||||
Utils::FileName fileName() const;
|
||||
void setFileName(const Utils::FileName &val);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
void update();
|
||||
|
||||
@@ -238,7 +229,7 @@ public:
|
||||
|
||||
void setSettingsKey(const QString &key);
|
||||
void makeOverridable(const QString &overridingKey, const QString &useOverridableKey);
|
||||
void addToConfigurationLayout(QFormLayout *layout);
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
void setLabelText(const QString &labelText);
|
||||
void setPlaceHolderText(const QString &placeHolderText);
|
||||
void setExecutablePathStyle(Utils::OsType osType);
|
||||
@@ -247,9 +238,6 @@ public:
|
||||
void setEnvironment(const Utils::Environment &env);
|
||||
void setDisplayStyle(BaseStringAspect::DisplayStyle style);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
|
||||
Reference in New Issue
Block a user