forked from qt-creator/qt-creator
ProjectExplorer: Fix copying of RunConfigurationAspects
Moving aspect data closer to real Value semantics fixes
the regression introduced by 890c1906e
.
Task-number: QTCREATORBUG-19186
Task-number: QTCREATORBUG-19192
Change-Id: Ieaeef3995ae06a817f266c1e2514f9e5793bd4e8
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -122,12 +122,6 @@ void BareMetalCustomRunConfiguration::initialize()
|
||||
BareMetalRunConfiguration::initialize(runConfigId(), QString());
|
||||
}
|
||||
|
||||
void BareMetalCustomRunConfiguration::copyFrom(const BareMetalCustomRunConfiguration *source)
|
||||
{
|
||||
BareMetalRunConfiguration::copyFrom(source);
|
||||
m_localExecutable = source->m_localExecutable;
|
||||
}
|
||||
|
||||
bool BareMetalCustomRunConfiguration::isConfigured() const
|
||||
{
|
||||
return !m_localExecutable.isEmpty();
|
||||
|
@@ -39,7 +39,6 @@ public:
|
||||
explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent);
|
||||
|
||||
void initialize();
|
||||
void copyFrom(const BareMetalCustomRunConfiguration *source);
|
||||
|
||||
bool isConfigured() const override;
|
||||
ConfigurationState ensureConfigured(QString *errorMessage) override;
|
||||
|
@@ -57,15 +57,6 @@ BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target)
|
||||
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
||||
}
|
||||
|
||||
void BareMetalRunConfiguration::copyFrom(const BareMetalRunConfiguration *other)
|
||||
{
|
||||
RunConfiguration::copyFrom(other);
|
||||
m_projectFilePath = other->m_projectFilePath;
|
||||
m_workingDirectory = other->m_workingDirectory;
|
||||
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
void BareMetalRunConfiguration::initialize(const Core::Id id, const QString &projectFilePath)
|
||||
{
|
||||
RunConfiguration::initialize(id);
|
||||
|
@@ -67,7 +67,6 @@ protected:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QString defaultDisplayName();
|
||||
void initialize(Core::Id id, const QString &projectFilePath);
|
||||
void copyFrom(const BareMetalRunConfiguration *source);
|
||||
|
||||
private:
|
||||
void handleBuildSystemDataUpdated();
|
||||
|
@@ -83,17 +83,6 @@ void CMakeRunConfiguration::initialize(Core::Id id, const QString &target,
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::copyFrom(const CMakeRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
|
||||
m_buildSystemTarget = source->m_buildSystemTarget;
|
||||
m_executable = source->m_executable;
|
||||
m_title = source->m_title;
|
||||
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
Runnable CMakeRunConfiguration::runnable() const
|
||||
{
|
||||
StandardRunnable r;
|
||||
|
@@ -59,7 +59,6 @@ public:
|
||||
private:
|
||||
void initialize(Core::Id id, const QString &target,
|
||||
const Utils::FileName &workingDirectory, const QString &title);
|
||||
void copyFrom(const CMakeRunConfiguration *source);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QString defaultDisplayName() const;
|
||||
|
@@ -330,10 +330,4 @@ void DebuggerRunConfigurationAspect::fromMap(const QVariantMap &map)
|
||||
d.useMultiProcess = map.value(QLatin1String(USE_MULTIPROCESS_KEY), false).toBool();
|
||||
}
|
||||
|
||||
DebuggerRunConfigurationAspect *DebuggerRunConfigurationAspect::create
|
||||
(RunConfiguration *runConfiguration) const
|
||||
{
|
||||
return new DebuggerRunConfigurationAspect(runConfiguration);
|
||||
}
|
||||
|
||||
} // namespace Debugger
|
||||
|
@@ -56,10 +56,9 @@ class DEBUGGER_EXPORT DebuggerRunConfigurationAspect
|
||||
|
||||
public:
|
||||
DebuggerRunConfigurationAspect(ProjectExplorer::RunConfiguration *runConfiguration);
|
||||
DebuggerRunConfigurationAspect *create(ProjectExplorer::RunConfiguration *runConfiguration) const;
|
||||
|
||||
void fromMap(const QVariantMap &map);
|
||||
void toMap(QVariantMap &map) const;
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
|
||||
bool useCppDebugger() const;
|
||||
void setUseCppDebugger(bool value);
|
||||
|
@@ -105,7 +105,6 @@ IosRunConfiguration::IosRunConfiguration(Target *target)
|
||||
this, &IosRunConfiguration::deviceChanges);
|
||||
}
|
||||
|
||||
|
||||
void IosRunConfiguration::initialize(Core::Id id, const FileName &path)
|
||||
{
|
||||
RunConfiguration::initialize(id);
|
||||
@@ -114,14 +113,6 @@ void IosRunConfiguration::initialize(Core::Id id, const FileName &path)
|
||||
updateDisplayNames();
|
||||
}
|
||||
|
||||
void IosRunConfiguration::copyFrom(const IosRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
m_profilePath = source->m_profilePath;
|
||||
|
||||
updateDisplayNames();
|
||||
}
|
||||
|
||||
void IosRunConfiguration::deviceChanges() {
|
||||
updateDisplayNames();
|
||||
updateEnabledState();
|
||||
|
@@ -72,7 +72,6 @@ signals:
|
||||
private:
|
||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||
void initialize(Core::Id id, const Utils::FileName &path);
|
||||
void copyFrom(const IosRunConfiguration *source);
|
||||
|
||||
void deviceChanges();
|
||||
friend class IosRunConfigurationWidget;
|
||||
|
@@ -63,7 +63,8 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
||||
if (mode == InstantApply) {
|
||||
argumentsAspect->addToMainConfigurationWidget(this, layout);
|
||||
} else {
|
||||
m_temporaryArgumentsAspect = argumentsAspect->clone(rc);
|
||||
m_temporaryArgumentsAspect = new ArgumentsAspect(rc, QString());
|
||||
m_temporaryArgumentsAspect->copyFrom(argumentsAspect);
|
||||
m_temporaryArgumentsAspect->addToMainConfigurationWidget(this, layout);
|
||||
connect(m_temporaryArgumentsAspect, &ArgumentsAspect::argumentsChanged,
|
||||
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||
@@ -80,7 +81,8 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
|
||||
if (mode == InstantApply) {
|
||||
terminalAspect->addToMainConfigurationWidget(this, layout);
|
||||
} else {
|
||||
m_temporaryTerminalAspect = terminalAspect->clone(rc);
|
||||
m_temporaryTerminalAspect = new TerminalAspect(rc, QString());
|
||||
m_temporaryTerminalAspect->copyFrom(terminalAspect);
|
||||
m_temporaryTerminalAspect->addToMainConfigurationWidget(this, layout);
|
||||
connect(m_temporaryTerminalAspect, &TerminalAspect::useTerminalChanged,
|
||||
this, &CustomExecutableConfigurationWidget::validChanged);
|
||||
|
@@ -101,15 +101,6 @@ void CustomExecutableRunConfiguration::initialize()
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
void CustomExecutableRunConfiguration::copyFrom(const CustomExecutableRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
m_executable = source->m_executable;
|
||||
m_workingDirectory = source->m_workingDirectory;
|
||||
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
// Note: Qt4Project deletes all empty customexecrunconfigs for which isConfigured() == false.
|
||||
CustomExecutableRunConfiguration::~CustomExecutableRunConfiguration()
|
||||
{
|
||||
|
@@ -67,8 +67,7 @@ signals:
|
||||
|
||||
protected:
|
||||
void initialize();
|
||||
void copyFrom(const CustomExecutableRunConfiguration *source);
|
||||
virtual bool fromMap(const QVariantMap &map) override;
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QString defaultDisplayName() const;
|
||||
|
||||
private:
|
||||
|
@@ -94,11 +94,4 @@ LocalEnvironmentAspect::LocalEnvironmentAspect(RunConfiguration *parent,
|
||||
this, &LocalEnvironmentAspect::buildEnvironmentHasChanged);
|
||||
}
|
||||
|
||||
LocalEnvironmentAspect *LocalEnvironmentAspect::create(RunConfiguration *parent) const
|
||||
{
|
||||
auto result = new LocalEnvironmentAspect(parent, m_baseEnvironmentModifier);
|
||||
result->setUserEnvironmentChanges(userEnvironmentChanges());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -36,7 +36,6 @@ class PROJECTEXPLORER_EXPORT LocalEnvironmentAspect : public EnvironmentAspect
|
||||
public:
|
||||
typedef std::function<void(RunConfiguration *, Utils::Environment &)> BaseEnvironmentModifier;
|
||||
LocalEnvironmentAspect(RunConfiguration *parent, const BaseEnvironmentModifier &modifier);
|
||||
LocalEnvironmentAspect *create(RunConfiguration *parent) const override;
|
||||
|
||||
QList<int> possibleBaseEnvironments() const override;
|
||||
QString baseEnvironmentDisplayName(int base) const override;
|
||||
|
@@ -110,6 +110,14 @@ RunConfigWidget *IRunConfigurationAspect::createConfigurationWidget() const
|
||||
return m_runConfigWidgetCreator ? m_runConfigWidgetCreator() : nullptr;
|
||||
}
|
||||
|
||||
void IRunConfigurationAspect::copyFrom(IRunConfigurationAspect *source)
|
||||
{
|
||||
QTC_ASSERT(source, return);
|
||||
QVariantMap data;
|
||||
source->toMap(data);
|
||||
fromMap(data);
|
||||
}
|
||||
|
||||
void IRunConfigurationAspect::setProjectSettings(ISettingsAspect *settings)
|
||||
{
|
||||
m_projectSettings = settings;
|
||||
@@ -132,12 +140,14 @@ ISettingsAspect *IRunConfigurationAspect::currentSettings() const
|
||||
|
||||
void IRunConfigurationAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (m_projectSettings)
|
||||
m_projectSettings->fromMap(map);
|
||||
m_useGlobalSettings = map.value(m_id.toString() + QLatin1String(".UseGlobalSettings"), true).toBool();
|
||||
}
|
||||
|
||||
void IRunConfigurationAspect::toMap(QVariantMap &map) const
|
||||
{
|
||||
if (m_projectSettings)
|
||||
m_projectSettings->toMap(map);
|
||||
map.insert(m_id.toString() + QLatin1String(".UseGlobalSettings"), m_useGlobalSettings);
|
||||
}
|
||||
@@ -147,21 +157,12 @@ void IRunConfigurationAspect::setRunConfigWidgetCreator(const RunConfigWidgetCre
|
||||
m_runConfigWidgetCreator = runConfigWidgetCreator;
|
||||
}
|
||||
|
||||
IRunConfigurationAspect *IRunConfigurationAspect::clone(RunConfiguration *runConfig) const
|
||||
{
|
||||
IRunConfigurationAspect *other = create(runConfig);
|
||||
if (m_projectSettings)
|
||||
other->m_projectSettings = m_projectSettings->clone();
|
||||
other->m_globalSettings = m_globalSettings;
|
||||
other->m_useGlobalSettings = m_useGlobalSettings;
|
||||
return other;
|
||||
}
|
||||
|
||||
void IRunConfigurationAspect::resetProjectToGlobalSettings()
|
||||
{
|
||||
QTC_ASSERT(m_globalSettings, return);
|
||||
QVariantMap map;
|
||||
m_globalSettings->toMap(map);
|
||||
if (m_projectSettings)
|
||||
m_projectSettings->fromMap(map);
|
||||
}
|
||||
|
||||
@@ -223,6 +224,9 @@ RunConfiguration::RunConfiguration(Target *target)
|
||||
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
|
||||
QCoreApplication::translate("ProjectExplorer", "The currently active run configuration's name."),
|
||||
[this] { return displayName(); }, false);
|
||||
|
||||
for (const AspectFactory &factory : theAspectFactories)
|
||||
addExtraAspect(factory(this));
|
||||
}
|
||||
|
||||
RunConfiguration::~RunConfiguration()
|
||||
@@ -233,20 +237,12 @@ RunConfiguration::~RunConfiguration()
|
||||
void RunConfiguration::initialize(Core::Id id)
|
||||
{
|
||||
StatefulProjectConfiguration::initialize(id);
|
||||
|
||||
for (const AspectFactory &factory : theAspectFactories)
|
||||
addExtraAspect(factory(this));
|
||||
}
|
||||
|
||||
void RunConfiguration::copyFrom(const RunConfiguration *source)
|
||||
{
|
||||
StatefulProjectConfiguration::copyFrom(source);
|
||||
|
||||
foreach (IRunConfigurationAspect *aspect, source->m_aspects) {
|
||||
IRunConfigurationAspect *clone = aspect->clone(this);
|
||||
if (clone)
|
||||
m_aspects.append(clone);
|
||||
}
|
||||
QVariantMap data = source->toMap();
|
||||
fromMap(data);
|
||||
}
|
||||
|
||||
bool RunConfiguration::isActive() const
|
||||
|
@@ -102,20 +102,20 @@ public:
|
||||
explicit IRunConfigurationAspect(RunConfiguration *runConfig);
|
||||
~IRunConfigurationAspect() override;
|
||||
|
||||
virtual IRunConfigurationAspect *create(RunConfiguration *runConfig) const = 0;
|
||||
virtual IRunConfigurationAspect *clone(RunConfiguration *runConfig) const;
|
||||
|
||||
using RunConfigWidgetCreator = std::function<RunConfigWidget *()>;
|
||||
void setRunConfigWidgetCreator(const RunConfigWidgetCreator &runConfigWidgetCreator);
|
||||
RunConfigWidget *createConfigurationWidget() const;
|
||||
void copyFrom(IRunConfigurationAspect *other);
|
||||
|
||||
void setId(Core::Id id) { m_id = id; }
|
||||
void setDisplayName(const QString &displayName) { m_displayName = displayName; }
|
||||
void setSettingsKey(const QString &settingsKey) { m_settingsKey = settingsKey; }
|
||||
void setProjectSettings(ISettingsAspect *settings);
|
||||
void setGlobalSettings(ISettingsAspect *settings);
|
||||
|
||||
QString displayName() const { return m_displayName; }
|
||||
Core::Id id() const { return m_id; }
|
||||
QString displayName() const { return m_displayName; }
|
||||
QString settingsKey() const { return m_settingsKey; }
|
||||
bool isUsingGlobalSettings() const { return m_useGlobalSettings; }
|
||||
void setUsingGlobalSettings(bool value);
|
||||
void resetProjectToGlobalSettings();
|
||||
@@ -133,6 +133,7 @@ protected:
|
||||
private:
|
||||
Core::Id m_id;
|
||||
QString m_displayName;
|
||||
QString m_settingsKey; // Name of data in settings.
|
||||
bool m_useGlobalSettings = false;
|
||||
RunConfiguration *m_runConfiguration = nullptr;
|
||||
ISettingsAspect *m_projectSettings = nullptr; // Owned if present.
|
||||
@@ -308,7 +309,7 @@ public:
|
||||
template <class RunConfig>
|
||||
static RunConfig *cloneHelper(Target *target, const RunConfiguration *source) {
|
||||
auto runConfig = new RunConfig(target);
|
||||
runConfig->copyFrom(static_cast<const RunConfig *>(source));
|
||||
runConfig->copyFrom(source);
|
||||
return runConfig;
|
||||
}
|
||||
|
||||
|
@@ -46,23 +46,12 @@ namespace ProjectExplorer {
|
||||
\class ProjectExplorer::TerminalAspect
|
||||
*/
|
||||
|
||||
TerminalAspect::TerminalAspect(RunConfiguration *runConfig, const QString &key,
|
||||
bool useTerminal, bool userSet) :
|
||||
IRunConfigurationAspect(runConfig),
|
||||
m_useTerminal(useTerminal), m_userSet(userSet), m_checkBox(nullptr), m_key(key)
|
||||
TerminalAspect::TerminalAspect(RunConfiguration *runConfig, const QString &key, bool useTerminal) :
|
||||
IRunConfigurationAspect(runConfig), m_useTerminal(useTerminal)
|
||||
{
|
||||
setDisplayName(tr("Terminal"));
|
||||
setId("TerminalAspect");
|
||||
}
|
||||
|
||||
TerminalAspect *TerminalAspect::create(RunConfiguration *runConfig) const
|
||||
{
|
||||
return new TerminalAspect(runConfig, m_key, false, false);
|
||||
}
|
||||
|
||||
TerminalAspect *TerminalAspect::clone(RunConfiguration *runConfig) const
|
||||
{
|
||||
return new TerminalAspect(runConfig, m_key, m_useTerminal, m_userSet);
|
||||
setSettingsKey(key);
|
||||
}
|
||||
|
||||
void TerminalAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
@@ -80,8 +69,8 @@ void TerminalAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *
|
||||
|
||||
void TerminalAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (map.contains(m_key)) {
|
||||
m_useTerminal = map.value(m_key).toBool();
|
||||
if (map.contains(settingsKey())) {
|
||||
m_useTerminal = map.value(settingsKey()).toBool();
|
||||
m_userSet = true;
|
||||
} else {
|
||||
m_userSet = false;
|
||||
@@ -91,7 +80,7 @@ void TerminalAspect::fromMap(const QVariantMap &map)
|
||||
void TerminalAspect::toMap(QVariantMap &data) const
|
||||
{
|
||||
if (m_userSet)
|
||||
data.insert(m_key, m_useTerminal);
|
||||
data.insert(settingsKey(), m_useTerminal);
|
||||
}
|
||||
|
||||
bool TerminalAspect::useTerminal() const
|
||||
@@ -129,23 +118,11 @@ void TerminalAspect::setRunMode(ApplicationLauncher::Mode runMode)
|
||||
*/
|
||||
|
||||
WorkingDirectoryAspect::WorkingDirectoryAspect(RunConfiguration *runConfig, const QString &key)
|
||||
: IRunConfigurationAspect(runConfig), m_key(key)
|
||||
: IRunConfigurationAspect(runConfig)
|
||||
{
|
||||
setDisplayName(tr("Working Directory"));
|
||||
setId("WorkingDirectoryAspect");
|
||||
}
|
||||
|
||||
WorkingDirectoryAspect *WorkingDirectoryAspect::create(RunConfiguration *runConfig) const
|
||||
{
|
||||
return new WorkingDirectoryAspect(runConfig, m_key);
|
||||
}
|
||||
|
||||
WorkingDirectoryAspect *WorkingDirectoryAspect::clone(RunConfiguration *runConfig) const
|
||||
{
|
||||
auto * const aspect = new WorkingDirectoryAspect(runConfig, m_key);
|
||||
aspect->m_defaultWorkingDirectory = m_defaultWorkingDirectory;
|
||||
aspect->m_workingDirectory = m_workingDirectory;
|
||||
return aspect;
|
||||
setSettingsKey(key);
|
||||
}
|
||||
|
||||
void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
@@ -157,7 +134,7 @@ void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QForm
|
||||
connect(m_resetButton.data(), &QAbstractButton::clicked, this, &WorkingDirectoryAspect::resetPath);
|
||||
|
||||
m_chooser = new PathChooser(parent);
|
||||
m_chooser->setHistoryCompleter(m_key);
|
||||
m_chooser->setHistoryCompleter(settingsKey());
|
||||
m_chooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
m_chooser->setPromptDialogTitle(tr("Select Working Directory"));
|
||||
m_chooser->setBaseFileName(m_defaultWorkingDirectory);
|
||||
@@ -185,7 +162,7 @@ void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QForm
|
||||
|
||||
QString WorkingDirectoryAspect::keyForDefaultWd() const
|
||||
{
|
||||
return m_key + QLatin1String(".default");
|
||||
return settingsKey() + ".default";
|
||||
}
|
||||
|
||||
void WorkingDirectoryAspect::resetPath()
|
||||
@@ -195,7 +172,7 @@ void WorkingDirectoryAspect::resetPath()
|
||||
|
||||
void WorkingDirectoryAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_workingDirectory = FileName::fromString(map.value(m_key).toString());
|
||||
m_workingDirectory = FileName::fromString(map.value(settingsKey()).toString());
|
||||
m_defaultWorkingDirectory = FileName::fromString(map.value(keyForDefaultWd()).toString());
|
||||
|
||||
if (m_workingDirectory.isEmpty())
|
||||
@@ -204,9 +181,9 @@ void WorkingDirectoryAspect::fromMap(const QVariantMap &map)
|
||||
|
||||
void WorkingDirectoryAspect::toMap(QVariantMap &data) const
|
||||
{
|
||||
const QString wd
|
||||
= (m_workingDirectory == m_defaultWorkingDirectory) ? QString() : m_workingDirectory.toString();
|
||||
data.insert(m_key, wd);
|
||||
const QString wd = m_workingDirectory == m_defaultWorkingDirectory
|
||||
? QString() : m_workingDirectory.toString();
|
||||
data.insert(settingsKey(), wd);
|
||||
data.insert(keyForDefaultWd(), m_defaultWorkingDirectory.toString());
|
||||
}
|
||||
|
||||
@@ -257,11 +234,12 @@ PathChooser *WorkingDirectoryAspect::pathChooser() const
|
||||
\class ProjectExplorer::ArgumentsAspect
|
||||
*/
|
||||
|
||||
ArgumentsAspect::ArgumentsAspect(RunConfiguration *runConfig, const QString &key, const QString &arguments)
|
||||
: IRunConfigurationAspect(runConfig), m_arguments(arguments), m_key(key)
|
||||
ArgumentsAspect::ArgumentsAspect(RunConfiguration *runConfig, const QString &key)
|
||||
: IRunConfigurationAspect(runConfig)
|
||||
{
|
||||
setDisplayName(tr("Arguments"));
|
||||
setId("ArgumentsAspect");
|
||||
setSettingsKey(key);
|
||||
}
|
||||
|
||||
QString ArgumentsAspect::arguments() const
|
||||
@@ -286,29 +264,19 @@ void ArgumentsAspect::setArguments(const QString &arguments)
|
||||
|
||||
void ArgumentsAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_arguments = map.value(m_key).toString();
|
||||
m_arguments = map.value(settingsKey()).toString();
|
||||
}
|
||||
|
||||
void ArgumentsAspect::toMap(QVariantMap &map) const
|
||||
{
|
||||
map.insert(m_key, m_arguments);
|
||||
}
|
||||
|
||||
ArgumentsAspect *ArgumentsAspect::create(RunConfiguration *runConfig) const
|
||||
{
|
||||
return new ArgumentsAspect(runConfig, m_key);
|
||||
}
|
||||
|
||||
ArgumentsAspect *ArgumentsAspect::clone(RunConfiguration *runConfig) const
|
||||
{
|
||||
return new ArgumentsAspect(runConfig, m_key, m_arguments);
|
||||
map.insert(settingsKey(), m_arguments);
|
||||
}
|
||||
|
||||
void ArgumentsAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!m_chooser);
|
||||
m_chooser = new FancyLineEdit(parent);
|
||||
m_chooser->setHistoryCompleter(m_key);
|
||||
m_chooser->setHistoryCompleter(settingsKey());
|
||||
m_chooser->setText(m_arguments);
|
||||
|
||||
connect(m_chooser.data(), &QLineEdit::textChanged, this, &ArgumentsAspect::setArguments);
|
||||
|
@@ -33,7 +33,6 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QFormLayout;
|
||||
class QLineEdit;
|
||||
class QToolButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -49,11 +48,8 @@ class PROJECTEXPLORER_EXPORT TerminalAspect : public IRunConfigurationAspect
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TerminalAspect(RunConfiguration *rc, const QString &key,
|
||||
bool useTerminal = false, bool userSet = false);
|
||||
|
||||
TerminalAspect *create(RunConfiguration *runConfig) const override;
|
||||
TerminalAspect *clone(RunConfiguration *runConfig) const override;
|
||||
TerminalAspect(RunConfiguration *rc, const QString &settingsKey,
|
||||
bool useTerminal = false);
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
|
||||
@@ -75,7 +71,6 @@ private:
|
||||
bool m_useTerminal = false;
|
||||
bool m_userSet = false;
|
||||
QPointer<QCheckBox> m_checkBox; // Owned by RunConfigWidget
|
||||
QString m_key;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT WorkingDirectoryAspect : public IRunConfigurationAspect
|
||||
@@ -83,10 +78,7 @@ class PROJECTEXPLORER_EXPORT WorkingDirectoryAspect : public IRunConfigurationAs
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WorkingDirectoryAspect(RunConfiguration *runConfig, const QString &key);
|
||||
|
||||
WorkingDirectoryAspect *create(RunConfiguration *runConfig) const override;
|
||||
WorkingDirectoryAspect *clone(RunConfiguration *runConfig) const override;
|
||||
explicit WorkingDirectoryAspect(RunConfiguration *runConfig, const QString &settingsKey);
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
|
||||
@@ -107,7 +99,6 @@ private:
|
||||
Utils::FileName m_defaultWorkingDirectory;
|
||||
QPointer<Utils::PathChooser> m_chooser;
|
||||
QPointer<QToolButton> m_resetButton;
|
||||
QString m_key;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ArgumentsAspect : public IRunConfigurationAspect
|
||||
@@ -115,10 +106,7 @@ class PROJECTEXPLORER_EXPORT ArgumentsAspect : public IRunConfigurationAspect
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ArgumentsAspect(RunConfiguration *runConfig, const QString &key, const QString &arguments = QString());
|
||||
|
||||
ArgumentsAspect *create(RunConfiguration *runConfig) const override;
|
||||
ArgumentsAspect *clone(RunConfiguration *runConfig) const override;
|
||||
explicit ArgumentsAspect(RunConfiguration *runConfig, const QString &settingsKey);
|
||||
|
||||
void addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout);
|
||||
|
||||
@@ -136,7 +124,6 @@ private:
|
||||
|
||||
QString m_arguments;
|
||||
QPointer<Utils::FancyLineEdit> m_chooser;
|
||||
QString m_key;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -167,7 +167,6 @@ public:
|
||||
private:
|
||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||
void initialize(Core::Id id);
|
||||
void copyFrom(const PythonRunConfiguration *source);
|
||||
|
||||
QString defaultDisplayName() const;
|
||||
|
||||
@@ -198,13 +197,6 @@ void PythonRunConfiguration::initialize(Core::Id id)
|
||||
m_interpreter = exec.isEmpty() ? "python" : exec;
|
||||
}
|
||||
|
||||
void PythonRunConfiguration::copyFrom(const PythonRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
m_interpreter = source->interpreter();
|
||||
m_mainScript = source->m_mainScript;
|
||||
}
|
||||
|
||||
QVariantMap PythonRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(RunConfiguration::toMap());
|
||||
|
@@ -144,21 +144,7 @@ void QbsRunConfiguration::initialize(Core::Id id)
|
||||
{
|
||||
RunConfiguration::initialize(id);
|
||||
m_uniqueProductName = uniqueProductNameFromId(id);
|
||||
ctor();
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::copyFrom(const QbsRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
m_uniqueProductName = source->m_uniqueProductName;
|
||||
m_currentInstallStep = nullptr; // no need to copy this, we will get if from the DC anyway.
|
||||
m_currentBuildStepList = nullptr; // ditto
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::ctor()
|
||||
{
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
installStepChanged();
|
||||
}
|
||||
|
@@ -71,15 +71,12 @@ signals:
|
||||
|
||||
private:
|
||||
void initialize(Core::Id id);
|
||||
void copyFrom(const QbsRunConfiguration *source);
|
||||
|
||||
void installStepChanged();
|
||||
void installStepToBeRemoved(int pos);
|
||||
QString baseWorkingDirectory() const;
|
||||
QString defaultDisplayName();
|
||||
|
||||
void ctor();
|
||||
|
||||
void updateTarget();
|
||||
|
||||
QString m_uniqueProductName;
|
||||
|
@@ -63,19 +63,6 @@ void QmakeAndroidRunConfiguration::initialize(Core::Id id)
|
||||
AndroidRunConfiguration::initialize(id);
|
||||
m_proFilePath = pathFromId(id);
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
void QmakeAndroidRunConfiguration::copyFrom(const QmakeAndroidRunConfiguration *source)
|
||||
{
|
||||
AndroidRunConfiguration::copyFrom(source);
|
||||
m_proFilePath = source->m_proFilePath;
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
void QmakeAndroidRunConfiguration::ctor()
|
||||
{
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
QTC_CHECK(!m_proFilePath.isEmpty());
|
||||
}
|
||||
|
@@ -55,14 +55,12 @@ public:
|
||||
private:
|
||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||
void initialize(Core::Id id);
|
||||
void copyFrom(const QmakeAndroidRunConfiguration *source);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
QString defaultDisplayName();
|
||||
|
||||
QmakeProjectManager::QmakeProject *qmakeProject() const;
|
||||
void ctor();
|
||||
|
||||
mutable Utils::FileName m_proFilePath;
|
||||
};
|
||||
|
@@ -85,6 +85,12 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target)
|
||||
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"));
|
||||
addExtraAspect(new TerminalAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"));
|
||||
addExtraAspect(new WorkingDirectoryAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"));
|
||||
|
||||
QmakeProject *project = qmakeProject();
|
||||
connect(project, &Project::parsingFinished,
|
||||
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
||||
connect(project, &QmakeProject::proFilesEvaluated,
|
||||
this, &DesktopQmakeRunConfiguration::proFileEvaluated);
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::initialize(Core::Id id)
|
||||
@@ -92,17 +98,7 @@ void DesktopQmakeRunConfiguration::initialize(Core::Id id)
|
||||
RunConfiguration::initialize(id);
|
||||
m_proFilePath = pathFromId(id);
|
||||
|
||||
ctor();
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::copyFrom(const DesktopQmakeRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
m_proFilePath = source->m_proFilePath;
|
||||
m_isUsingDyldImageSuffix = source->m_isUsingDyldImageSuffix;
|
||||
m_isUsingLibrarySearchPath = source->m_isUsingLibrarySearchPath;
|
||||
|
||||
ctor();
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::proFileEvaluated()
|
||||
@@ -129,19 +125,6 @@ void DesktopQmakeRunConfiguration::updateTargetInformation()
|
||||
emit effectiveTargetInformationChanged();
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::ctor()
|
||||
{
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
|
||||
QmakeProject *project = qmakeProject();
|
||||
connect(project, &Project::parsingFinished,
|
||||
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
||||
connect(project, &QmakeProject::proFilesEvaluated,
|
||||
this, &DesktopQmakeRunConfiguration::proFileEvaluated);
|
||||
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
//////
|
||||
/// DesktopQmakeRunConfigurationWidget
|
||||
/////
|
||||
|
@@ -88,8 +88,6 @@ signals:
|
||||
|
||||
protected:
|
||||
void initialize(Core::Id id);
|
||||
void copyFrom(const DesktopQmakeRunConfiguration *source);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
private:
|
||||
@@ -103,8 +101,6 @@ private:
|
||||
QmakeProject *qmakeProject() const;
|
||||
QmakeProFile *proFile() const;
|
||||
|
||||
void ctor();
|
||||
|
||||
void updateTarget();
|
||||
Utils::FileName m_proFilePath; // Full path to the Application Pro File
|
||||
|
||||
|
@@ -46,11 +46,5 @@ QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(
|
||||
setRunConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||
}
|
||||
|
||||
ProjectExplorer::IRunConfigurationAspect *QmlProfilerRunConfigurationAspect::create(
|
||||
ProjectExplorer::RunConfiguration *runConfig) const
|
||||
{
|
||||
return new QmlProfilerRunConfigurationAspect(runConfig);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // QmlProfiler
|
||||
|
@@ -34,9 +34,6 @@ class QmlProfilerRunConfigurationAspect : public ProjectExplorer::IRunConfigurat
|
||||
{
|
||||
public:
|
||||
QmlProfilerRunConfigurationAspect(ProjectExplorer::RunConfiguration *parent);
|
||||
|
||||
ProjectExplorer::IRunConfigurationAspect *create(
|
||||
ProjectExplorer::RunConfiguration *runConfig) const;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
@@ -64,9 +64,4 @@ QmlProjectEnvironmentAspect::QmlProjectEnvironmentAspect(ProjectExplorer::RunCon
|
||||
ProjectExplorer::EnvironmentAspect(rc)
|
||||
{ }
|
||||
|
||||
QmlProjectEnvironmentAspect *QmlProjectEnvironmentAspect::create(ProjectExplorer::RunConfiguration *parent) const
|
||||
{
|
||||
return new QmlProjectEnvironmentAspect(parent);
|
||||
}
|
||||
|
||||
} // namespace QmlProjectManager
|
||||
|
@@ -35,11 +35,10 @@ class QmlProjectEnvironmentAspect : public ProjectExplorer::EnvironmentAspect
|
||||
|
||||
public:
|
||||
QmlProjectEnvironmentAspect(ProjectExplorer::RunConfiguration *rc);
|
||||
QmlProjectEnvironmentAspect *create(ProjectExplorer::RunConfiguration *parent) const;
|
||||
|
||||
QList<int> possibleBaseEnvironments() const;
|
||||
QString baseEnvironmentDisplayName(int base) const;
|
||||
Utils::Environment baseEnvironment() const;
|
||||
QList<int> possibleBaseEnvironments() const override;
|
||||
QString baseEnvironmentDisplayName(int base) const override;
|
||||
Utils::Environment baseEnvironment() const override;
|
||||
|
||||
private:
|
||||
enum BaseEnvironmentBase {
|
||||
|
@@ -79,17 +79,6 @@ void QmlProjectRunConfiguration::initialize(Id id)
|
||||
updateEnabledState();
|
||||
}
|
||||
|
||||
void QmlProjectRunConfiguration::copyFrom(const QmlProjectRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
m_currentFileFilename = source->m_currentFileFilename;
|
||||
m_mainScriptFilename = source->m_mainScriptFilename;
|
||||
m_scriptFile = source->m_scriptFile;
|
||||
m_qmlViewerArgs = source->m_qmlViewerArgs;
|
||||
|
||||
updateEnabledState();
|
||||
}
|
||||
|
||||
Runnable QmlProjectRunConfiguration::runnable() const
|
||||
{
|
||||
StandardRunnable r;
|
||||
|
@@ -78,8 +78,7 @@ signals:
|
||||
|
||||
private:
|
||||
void initialize(Core::Id id);
|
||||
void copyFrom(const QmlProjectRunConfiguration *source);
|
||||
virtual bool fromMap(const QVariantMap &map) override;
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
void changeCurrentFile(Core::IEditor* = 0);
|
||||
void updateEnabledState() final;
|
||||
|
@@ -45,17 +45,6 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target)
|
||||
: RemoteLinuxRunConfiguration(target)
|
||||
{}
|
||||
|
||||
void QnxRunConfiguration::initialize(Core::Id id, const QString &targetName)
|
||||
{
|
||||
RemoteLinuxRunConfiguration::initialize(id, targetName);
|
||||
}
|
||||
|
||||
void QnxRunConfiguration::copyFrom(const QnxRunConfiguration *source)
|
||||
{
|
||||
RemoteLinuxRunConfiguration::copyFrom(source);
|
||||
m_qtLibPath = source->m_qtLibPath;
|
||||
}
|
||||
|
||||
Runnable QnxRunConfiguration::runnable() const
|
||||
{
|
||||
auto r = RemoteLinuxRunConfiguration::runnable().as<StandardRunnable>();
|
||||
|
@@ -37,17 +37,11 @@ class QnxRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration
|
||||
public:
|
||||
explicit QnxRunConfiguration(ProjectExplorer::Target *target);
|
||||
|
||||
ProjectExplorer::Runnable runnable() const override;
|
||||
|
||||
QWidget *createConfigurationWidget() override;
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
private:
|
||||
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||
|
||||
void copyFrom(const QnxRunConfiguration *source);
|
||||
void initialize(Core::Id id, const QString &targetName);
|
||||
ProjectExplorer::Runnable runnable() const override;
|
||||
QWidget *createConfigurationWidget() override;
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
QString m_qtLibPath;
|
||||
|
@@ -109,18 +109,6 @@ void RemoteLinuxCustomRunConfiguration::initialize()
|
||||
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
|
||||
{
|
||||
return !m_remoteExecutable.isEmpty();
|
||||
|
@@ -37,7 +37,6 @@ public:
|
||||
explicit RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *target);
|
||||
|
||||
void initialize();
|
||||
void copyFrom(const RemoteLinuxCustomRunConfiguration *source);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QVariantMap toMap() const override;
|
||||
|
@@ -55,11 +55,6 @@ RemoteLinuxEnvironmentAspect::RemoteLinuxEnvironmentAspect(ProjectExplorer::RunC
|
||||
setRunConfigWidgetCreator([this] { return new RemoteLinuxEnvironmentAspectWidget(this); });
|
||||
}
|
||||
|
||||
RemoteLinuxEnvironmentAspect *RemoteLinuxEnvironmentAspect::create(ProjectExplorer::RunConfiguration *parent) const
|
||||
{
|
||||
return new RemoteLinuxEnvironmentAspect(parent);
|
||||
}
|
||||
|
||||
QList<int> RemoteLinuxEnvironmentAspect::possibleBaseEnvironments() const
|
||||
{
|
||||
return QList<int>() << static_cast<int>(RemoteBaseEnvironment)
|
||||
|
@@ -37,7 +37,6 @@ class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer::
|
||||
|
||||
public:
|
||||
RemoteLinuxEnvironmentAspect(ProjectExplorer::RunConfiguration *rc);
|
||||
RemoteLinuxEnvironmentAspect *create(ProjectExplorer::RunConfiguration *parent) const override;
|
||||
|
||||
QList<int> possibleBaseEnvironments() const override;
|
||||
QString baseEnvironmentDisplayName(int base) const override;
|
||||
|
@@ -88,14 +88,6 @@ void RemoteLinuxRunConfiguration::initialize(Core::Id id, const QString &targetN
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
void RemoteLinuxRunConfiguration::copyFrom(const RemoteLinuxRunConfiguration *source)
|
||||
{
|
||||
RunConfiguration::copyFrom(source);
|
||||
*d = *source->d;
|
||||
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
}
|
||||
|
||||
RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
|
||||
{
|
||||
delete d;
|
||||
|
@@ -75,7 +75,6 @@ signals:
|
||||
|
||||
protected:
|
||||
void initialize(Core::Id id, const QString &targetName);
|
||||
void copyFrom(const RemoteLinuxRunConfiguration *source);
|
||||
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
QString defaultDisplayName();
|
||||
|
@@ -103,11 +103,6 @@ public:
|
||||
resetProjectToGlobalSettings();
|
||||
setRunConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||
}
|
||||
|
||||
ValgrindRunConfigurationAspect *create(RunConfiguration *parent) const override
|
||||
{
|
||||
return new ValgrindRunConfigurationAspect(parent);
|
||||
}
|
||||
};
|
||||
|
||||
ValgrindPlugin::~ValgrindPlugin()
|
||||
|
Reference in New Issue
Block a user