forked from qt-creator/qt-creator
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:
@@ -45,13 +45,8 @@ const char amStartArgsKey[] = "Android.AmStartArgsKey";
|
|||||||
const char preStartShellCmdsKey[] = "Android.PreStartShellCmdListKey";
|
const char preStartShellCmdsKey[] = "Android.PreStartShellCmdListKey";
|
||||||
const char postFinishShellCmdsKey[] = "Android.PostFinishShellCmdListKey";
|
const char postFinishShellCmdsKey[] = "Android.PostFinishShellCmdListKey";
|
||||||
|
|
||||||
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id)
|
AndroidRunConfiguration::AndroidRunConfiguration(Target *target)
|
||||||
: RunConfiguration(parent, id)
|
: RunConfiguration(target)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, AndroidRunConfiguration *source)
|
|
||||||
: RunConfiguration(parent, source)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,17 +29,13 @@
|
|||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QToolButton;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
|
|
||||||
class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
|
class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit AndroidRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
Utils::OutputFormatter *createOutputFormatter() const override;
|
Utils::OutputFormatter *createOutputFormatter() const override;
|
||||||
@@ -51,15 +47,12 @@ public:
|
|||||||
const QStringList &preStartShellCommands() const;
|
const QStringList &preStartShellCommands() const;
|
||||||
const QStringList &postFinishShellCommands() const;
|
const QStringList &postFinishShellCommands() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// FIXME: This appears to miss a copyFrom() implementation.
|
||||||
void setPreStartShellCommands(const QStringList &cmdList);
|
void setPreStartShellCommands(const QStringList &cmdList);
|
||||||
void setPostFinishShellCommands(const QStringList &cmdList);
|
void setPostFinishShellCommands(const QStringList &cmdList);
|
||||||
void setAmStartExtraArgs(const QStringList &args);
|
void setAmStartExtraArgs(const QStringList &args);
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_amStartExtraArgs;
|
QStringList m_amStartExtraArgs;
|
||||||
QStringList m_preStartShellCommands;
|
QStringList m_preStartShellCommands;
|
||||||
QStringList m_postFinishShellCommands;
|
QStringList m_postFinishShellCommands;
|
||||||
|
@@ -47,8 +47,9 @@ class TestRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TestRunConfiguration(ProjectExplorer::Target *parent, TestConfiguration *config)
|
TestRunConfiguration(ProjectExplorer::Target *parent, TestConfiguration *config)
|
||||||
: ProjectExplorer::RunConfiguration(parent, "AutoTest.TestRunConfig")
|
: ProjectExplorer::RunConfiguration(parent)
|
||||||
{
|
{
|
||||||
|
initialize("AutoTest.TestRunConfig");
|
||||||
setDefaultDisplayName(tr("AutoTest Debug"));
|
setDefaultDisplayName(tr("AutoTest Debug"));
|
||||||
|
|
||||||
// disable QmlDebugger that is enabled by default
|
// disable QmlDebugger that is enabled by default
|
||||||
|
@@ -113,15 +113,19 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent)
|
BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent)
|
||||||
: BareMetalRunConfiguration(parent, runConfigId(), QString())
|
: BareMetalRunConfiguration(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent,
|
void BareMetalCustomRunConfiguration::initialize()
|
||||||
BareMetalCustomRunConfiguration *source)
|
|
||||||
: BareMetalRunConfiguration(parent, source)
|
|
||||||
, m_localExecutable(source->m_localExecutable)
|
|
||||||
{
|
{
|
||||||
|
BareMetalRunConfiguration::initialize(runConfigId(), QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BareMetalCustomRunConfiguration::copyFrom(const BareMetalCustomRunConfiguration *source)
|
||||||
|
{
|
||||||
|
BareMetalRunConfiguration::copyFrom(source);
|
||||||
|
m_localExecutable = source->m_localExecutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BareMetalCustomRunConfiguration::isConfigured() const
|
bool BareMetalCustomRunConfiguration::isConfigured() const
|
||||||
|
@@ -36,9 +36,10 @@ class BareMetalCustomRunConfiguration : public BareMetalRunConfiguration
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent);
|
explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent);
|
||||||
BareMetalCustomRunConfiguration(ProjectExplorer::Target *parent,
|
|
||||||
BareMetalCustomRunConfiguration *source);
|
void initialize();
|
||||||
|
void copyFrom(const BareMetalCustomRunConfiguration *source);
|
||||||
|
|
||||||
bool isConfigured() const override;
|
bool isConfigured() const override;
|
||||||
ConfigurationState ensureConfigured(QString *errorMessage) override;
|
ConfigurationState ensureConfigured(QString *errorMessage) override;
|
||||||
|
@@ -45,36 +45,35 @@ const char ProFileKey[] = "Qt4ProjectManager.MaemoRunConfiguration.ProFile";
|
|||||||
const char WorkingDirectoryKey[] = "BareMetal.RunConfig.WorkingDirectory";
|
const char WorkingDirectoryKey[] = "BareMetal.RunConfig.WorkingDirectory";
|
||||||
|
|
||||||
|
|
||||||
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *parent, BareMetalRunConfiguration *other)
|
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target)
|
||||||
: RunConfiguration(parent, other),
|
: RunConfiguration(target)
|
||||||
m_projectFilePath(other->m_projectFilePath),
|
|
||||||
m_workingDirectory(other->m_workingDirectory)
|
|
||||||
{
|
{
|
||||||
init();
|
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.MaemoRunConfiguration.Arguments"));
|
||||||
}
|
connect(target, &Target::deploymentDataChanged,
|
||||||
|
|
||||||
BareMetalRunConfiguration::BareMetalRunConfiguration(Target *parent,
|
|
||||||
const Core::Id id,
|
|
||||||
const QString &projectFilePath)
|
|
||||||
: RunConfiguration(parent, id),
|
|
||||||
m_projectFilePath(projectFilePath)
|
|
||||||
{
|
|
||||||
addExtraAspect(new ArgumentsAspect(this, QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.Arguments")));
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BareMetalRunConfiguration::init()
|
|
||||||
{
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
|
|
||||||
connect(target(), &Target::deploymentDataChanged,
|
|
||||||
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated);
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated);
|
||||||
connect(target(), &Target::applicationTargetsChanged,
|
connect(target, &Target::applicationTargetsChanged,
|
||||||
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated);
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated);
|
||||||
connect(target(), &Target::kitChanged,
|
connect(target, &Target::kitChanged,
|
||||||
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
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);
|
||||||
|
m_projectFilePath = projectFilePath;
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return new BareMetalRunConfigurationWidget(this);
|
return new BareMetalRunConfigurationWidget(this);
|
||||||
|
@@ -37,12 +37,11 @@ class BareMetalRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(BareMetalRunConfiguration)
|
Q_DISABLE_COPY(BareMetalRunConfiguration)
|
||||||
|
|
||||||
friend class BareMetalRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
friend class BareMetalRunConfigurationWidget;
|
friend class BareMetalRunConfigurationWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BareMetalRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
|
explicit BareMetalRunConfiguration(ProjectExplorer::Target *target);
|
||||||
const QString &projectFilePath);
|
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
Utils::OutputFormatter *createOutputFormatter() const override;
|
Utils::OutputFormatter *createOutputFormatter() const override;
|
||||||
@@ -65,13 +64,13 @@ signals:
|
|||||||
void targetInformationChanged() const;
|
void targetInformationChanged() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BareMetalRunConfiguration(ProjectExplorer::Target *parent, BareMetalRunConfiguration *source);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
|
void initialize(Core::Id id, const QString &projectFilePath);
|
||||||
|
void copyFrom(const BareMetalRunConfiguration *source);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleBuildSystemDataUpdated();
|
void handleBuildSystemDataUpdated();
|
||||||
void init();
|
|
||||||
|
|
||||||
QString m_projectFilePath;
|
QString m_projectFilePath;
|
||||||
QString m_workingDirectory;
|
QString m_workingDirectory;
|
||||||
|
@@ -107,7 +107,7 @@ RunConfiguration *BareMetalRunConfigurationFactory::doCreate(Target *parent, Cor
|
|||||||
{
|
{
|
||||||
if (id == BareMetalCustomRunConfiguration::runConfigId())
|
if (id == BareMetalCustomRunConfiguration::runConfigId())
|
||||||
return new BareMetalCustomRunConfiguration(parent);
|
return new BareMetalCustomRunConfiguration(parent);
|
||||||
return new BareMetalRunConfiguration(parent, id, pathFromId(id));
|
return createHelper<BareMetalRunConfiguration>(parent, id, pathFromId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *BareMetalRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *BareMetalRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
@@ -120,10 +120,9 @@ RunConfiguration *BareMetalRunConfigurationFactory::doRestore(Target *parent, co
|
|||||||
RunConfiguration *BareMetalRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
RunConfiguration *BareMetalRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(canClone(parent, source), return 0);
|
QTC_ASSERT(canClone(parent, source), return 0);
|
||||||
if (BareMetalCustomRunConfiguration *old = qobject_cast<BareMetalCustomRunConfiguration *>(source))
|
if (qobject_cast<BareMetalCustomRunConfiguration *>(source))
|
||||||
return new BareMetalCustomRunConfiguration(parent, old);
|
return cloneHelper<BareMetalCustomRunConfiguration>(parent, source);
|
||||||
BareMetalRunConfiguration *old = static_cast<BareMetalRunConfiguration*>(source);
|
return cloneHelper<BareMetalRunConfiguration>(parent, source);
|
||||||
return new BareMetalRunConfiguration(parent,old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BareMetalRunConfigurationFactory::canHandle(const Target *target) const
|
bool BareMetalRunConfigurationFactory::canHandle(const Target *target) const
|
||||||
|
@@ -71,8 +71,9 @@ class DummyRunConfiguration : public RunConfiguration
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DummyRunConfiguration(Target *parent)
|
DummyRunConfiguration(Target *parent)
|
||||||
: RunConfiguration(parent, "ClangStaticAnalyzer.DummyRunConfig")
|
: RunConfiguration(parent)
|
||||||
{
|
{
|
||||||
|
initialize("ClangStaticAnalyzer.DummyRunConfig");
|
||||||
setDefaultDisplayName(tr("Clang Static Analyzer"));
|
setDefaultDisplayName(tr("Clang Static Analyzer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -60,35 +60,36 @@ const char CMAKE_RC_PREFIX[] = "CMakeProjectManager.CMakeRunConfiguration.";
|
|||||||
const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
|
const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, Core::Id id, const QString &target,
|
CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
||||||
const Utils::FileName &workingDirectory, const QString &title) :
|
: RunConfiguration(target)
|
||||||
RunConfiguration(parent, id),
|
|
||||||
m_buildSystemTarget(target),
|
|
||||||
m_executable(target),
|
|
||||||
m_title(title)
|
|
||||||
{
|
{
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
||||||
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("CMakeProjectManager.CMakeRunConfiguration.Arguments")));
|
addExtraAspect(new ArgumentsAspect(this, "CMakeProjectManager.CMakeRunConfiguration.Arguments"));
|
||||||
addExtraAspect(new TerminalAspect(this, QStringLiteral("CMakeProjectManager.CMakeRunConfiguration.UseTerminal")));
|
addExtraAspect(new TerminalAspect(this, "CMakeProjectManager.CMakeRunConfiguration.UseTerminal"));
|
||||||
|
addExtraAspect(new WorkingDirectoryAspect(this, "CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"));
|
||||||
auto wd = new WorkingDirectoryAspect(this, QStringLiteral("CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"));
|
|
||||||
wd->setDefaultWorkingDirectory(workingDirectory);
|
|
||||||
addExtraAspect(wd);
|
|
||||||
|
|
||||||
ctor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *parent, CMakeRunConfiguration *source) :
|
void CMakeRunConfiguration::initialize(Core::Id id, const QString &target,
|
||||||
RunConfiguration(parent, source),
|
const Utils::FileName &workingDirectory, const QString &title)
|
||||||
m_buildSystemTarget(source->m_buildSystemTarget),
|
|
||||||
m_executable(source->m_executable),
|
|
||||||
m_title(source->m_title)
|
|
||||||
{
|
{
|
||||||
ctor();
|
RunConfiguration::initialize(id);
|
||||||
|
m_buildSystemTarget = target;
|
||||||
|
m_executable = target;
|
||||||
|
m_title = title;
|
||||||
|
|
||||||
|
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(workingDirectory);
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeRunConfiguration::ctor()
|
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());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +257,7 @@ RunConfiguration *CMakeRunConfigurationFactory::doCreate(Target *parent, Core::I
|
|||||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||||
const QString title(buildTargetFromId(id));
|
const QString title(buildTargetFromId(id));
|
||||||
const CMakeBuildTarget &ct = project->buildTargetForTitle(title);
|
const CMakeBuildTarget &ct = project->buildTargetForTitle(title);
|
||||||
return new CMakeRunConfiguration(parent, id, title, ct.workingDirectory, ct.title);
|
return createHelper<CMakeRunConfiguration>(parent, id, title, ct.workingDirectory, ct.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
bool CMakeRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
||||||
@@ -270,8 +271,7 @@ RunConfiguration *CMakeRunConfigurationFactory::clone(Target *parent, RunConfigu
|
|||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
CMakeRunConfiguration *crc(static_cast<CMakeRunConfiguration *>(source));
|
return cloneHelper<CMakeRunConfiguration>(parent, source);
|
||||||
return new CMakeRunConfiguration(parent, crc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
bool CMakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||||
@@ -284,7 +284,7 @@ bool CMakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap
|
|||||||
RunConfiguration *CMakeRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *CMakeRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
const Core::Id id = idFromMap(map);
|
const Core::Id id = idFromMap(map);
|
||||||
return new CMakeRunConfiguration(parent, id, buildTargetFromId(id), Utils::FileName(), QString());
|
return createHelper<CMakeRunConfiguration>(parent, id, buildTargetFromId(id), Utils::FileName(), QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)
|
QString CMakeRunConfigurationFactory::buildTargetFromId(Core::Id id)
|
||||||
|
@@ -35,11 +35,10 @@ class CMakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class CMakeRunConfigurationWidget;
|
friend class CMakeRunConfigurationWidget;
|
||||||
friend class CMakeRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &target,
|
explicit CMakeRunConfiguration(ProjectExplorer::Target *target);
|
||||||
const Utils::FileName &workingDirectory, const QString &title);
|
|
||||||
|
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
@@ -55,18 +54,19 @@ public:
|
|||||||
|
|
||||||
QString buildSystemTarget() const final { return m_buildSystemTarget; }
|
QString buildSystemTarget() const final { return m_buildSystemTarget; }
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
CMakeRunConfiguration(ProjectExplorer::Target *parent, CMakeRunConfiguration *source);
|
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;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|
||||||
void updateEnabledState() final;
|
void updateEnabledState() final;
|
||||||
|
|
||||||
private:
|
|
||||||
QString baseWorkingDirectory() const;
|
QString baseWorkingDirectory() const;
|
||||||
void ctor();
|
|
||||||
|
|
||||||
const QString m_buildSystemTarget;
|
QString m_buildSystemTarget;
|
||||||
QString m_executable;
|
QString m_executable;
|
||||||
QString m_title;
|
QString m_title;
|
||||||
};
|
};
|
||||||
|
@@ -502,7 +502,7 @@ Project::RestoreResult GenericProject::fromMap(const QVariantMap &map, QString *
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!t->activeRunConfiguration())
|
if (!t->activeRunConfiguration())
|
||||||
t->addRunConfiguration(new CustomExecutableRunConfiguration(t));
|
t->addRunConfiguration(IRunConfigurationFactory::createHelper<CustomExecutableRunConfiguration>(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_activeTarget = activeTarget();
|
m_activeTarget = activeTarget();
|
||||||
|
@@ -94,30 +94,34 @@ private:
|
|||||||
QComboBox *m_deviceTypeComboBox;
|
QComboBox *m_deviceTypeComboBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
IosRunConfiguration::IosRunConfiguration(Target *parent, Core::Id id, const FileName &path)
|
IosRunConfiguration::IosRunConfiguration(Target *target)
|
||||||
: RunConfiguration(parent, id)
|
: RunConfiguration(target)
|
||||||
, m_profilePath(path)
|
|
||||||
{
|
{
|
||||||
addExtraAspect(new ArgumentsAspect(this, QLatin1String("Ios.run_arguments")));
|
addExtraAspect(new ArgumentsAspect(this, "Ios.run_arguments"));
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
IosRunConfiguration::IosRunConfiguration(Target *parent, IosRunConfiguration *source)
|
|
||||||
: RunConfiguration(parent, source)
|
|
||||||
, m_profilePath(source->m_profilePath)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosRunConfiguration::init()
|
|
||||||
{
|
|
||||||
updateDisplayNames();
|
|
||||||
connect(DeviceManager::instance(), &DeviceManager::updated,
|
connect(DeviceManager::instance(), &DeviceManager::updated,
|
||||||
this, &IosRunConfiguration::deviceChanges);
|
this, &IosRunConfiguration::deviceChanges);
|
||||||
connect(KitManager::instance(), &KitManager::kitsChanged,
|
connect(KitManager::instance(), &KitManager::kitsChanged,
|
||||||
this, &IosRunConfiguration::deviceChanges);
|
this, &IosRunConfiguration::deviceChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void IosRunConfiguration::initialize(Core::Id id, const FileName &path)
|
||||||
|
{
|
||||||
|
RunConfiguration::initialize(id);
|
||||||
|
m_profilePath = path;
|
||||||
|
|
||||||
|
updateDisplayNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IosRunConfiguration::copyFrom(const IosRunConfiguration *source)
|
||||||
|
{
|
||||||
|
RunConfiguration::copyFrom(source);
|
||||||
|
m_profilePath = source->m_profilePath;
|
||||||
|
|
||||||
|
updateDisplayNames();
|
||||||
|
}
|
||||||
|
|
||||||
void IosRunConfiguration::deviceChanges() {
|
void IosRunConfiguration::deviceChanges() {
|
||||||
updateDisplayNames();
|
updateDisplayNames();
|
||||||
updateEnabledState();
|
updateEnabledState();
|
||||||
|
@@ -44,10 +44,9 @@ class IosRunConfigurationWidget;
|
|||||||
class IosRunConfiguration : public ProjectExplorer::RunConfiguration
|
class IosRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class IosRunConfigurationFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IosRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const Utils::FileName &path);
|
explicit IosRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
Utils::OutputFormatter *createOutputFormatter() const override;
|
Utils::OutputFormatter *createOutputFormatter() const override;
|
||||||
@@ -67,15 +66,15 @@ public:
|
|||||||
|
|
||||||
QString buildSystemTarget() const final;
|
QString buildSystemTarget() const final;
|
||||||
|
|
||||||
protected:
|
|
||||||
IosRunConfiguration(ProjectExplorer::Target *parent, IosRunConfiguration *source);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void localExecutableChanged();
|
void localExecutableChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
void initialize(Core::Id id, const Utils::FileName &path);
|
||||||
|
void copyFrom(const IosRunConfiguration *source);
|
||||||
|
|
||||||
void deviceChanges();
|
void deviceChanges();
|
||||||
void init();
|
|
||||||
friend class IosRunConfigurationWidget;
|
friend class IosRunConfigurationWidget;
|
||||||
void updateDisplayNames();
|
void updateDisplayNames();
|
||||||
void updateEnabledState() final;
|
void updateEnabledState() final;
|
||||||
|
@@ -108,8 +108,7 @@ RunConfiguration *IosRunConfigurationFactory::clone(Target *parent, RunConfigura
|
|||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
IosRunConfiguration *old = qobject_cast<IosRunConfiguration *>(source);
|
return cloneHelper<IosRunConfiguration>(parent, source);
|
||||||
return new IosRunConfiguration(parent, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosRunConfigurationFactory::canHandle(Target *t) const
|
bool IosRunConfigurationFactory::canHandle(Target *t) const
|
||||||
@@ -133,13 +132,13 @@ QList<RunConfiguration *> IosRunConfigurationFactory::runConfigurationsForNode(T
|
|||||||
|
|
||||||
RunConfiguration *IosRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *IosRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
return new IosRunConfiguration(parent, id, pathFromId(id));
|
return createHelper<IosRunConfiguration>(parent, id, pathFromId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *IosRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *IosRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
Core::Id id = ProjectExplorer::idFromMap(map);
|
Core::Id id = ProjectExplorer::idFromMap(map);
|
||||||
return new IosRunConfiguration(parent, id, pathFromId(id));
|
return createHelper<IosRunConfiguration>(parent, id, pathFromId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -44,9 +44,8 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
NimRunConfiguration::NimRunConfiguration(Target *parent, Core::Id id)
|
NimRunConfiguration::NimRunConfiguration(Target *target)
|
||||||
: RunConfiguration(parent, id)
|
: RunConfiguration(target)
|
||||||
, m_buildConfiguration(nullptr)
|
|
||||||
, m_workingDirectoryAspect(new WorkingDirectoryAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_WORKINGDIRECTORYASPECT_ID))
|
, m_workingDirectoryAspect(new WorkingDirectoryAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_WORKINGDIRECTORYASPECT_ID))
|
||||||
, m_argumentAspect(new ArgumentsAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_ARGUMENTASPECT_ID))
|
, m_argumentAspect(new ArgumentsAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_ARGUMENTASPECT_ID))
|
||||||
, m_terminalAspect(new TerminalAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_TERMINALASPECT_ID))
|
, m_terminalAspect(new TerminalAspect(this, Nim::Constants::C_NIMRUNCONFIGURATION_TERMINALASPECT_ID))
|
||||||
@@ -62,9 +61,8 @@ NimRunConfiguration::NimRunConfiguration(Target *parent, Core::Id id)
|
|||||||
setDefaultDisplayName(tr(Constants::C_NIMRUNCONFIGURATION_DEFAULT_DISPLAY));
|
setDefaultDisplayName(tr(Constants::C_NIMRUNCONFIGURATION_DEFAULT_DISPLAY));
|
||||||
|
|
||||||
// Connect target signals
|
// Connect target signals
|
||||||
connect(this->target(), &Target::activeBuildConfigurationChanged,
|
connect(target, &Target::activeBuildConfigurationChanged,
|
||||||
this, &NimRunConfiguration::updateConfiguration);
|
this, &NimRunConfiguration::updateConfiguration);
|
||||||
|
|
||||||
updateConfiguration();
|
updateConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ class NimRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NimRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit NimRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
@@ -65,7 +65,7 @@ private:
|
|||||||
void setActiveBuildConfiguration(NimBuildConfiguration *activeBuildConfiguration);
|
void setActiveBuildConfiguration(NimBuildConfiguration *activeBuildConfiguration);
|
||||||
|
|
||||||
QString m_executable;
|
QString m_executable;
|
||||||
NimBuildConfiguration *m_buildConfiguration;
|
NimBuildConfiguration *m_buildConfiguration = nullptr;
|
||||||
ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect;
|
ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect;
|
||||||
ProjectExplorer::ArgumentsAspect* m_argumentAspect;
|
ProjectExplorer::ArgumentsAspect* m_argumentAspect;
|
||||||
ProjectExplorer::TerminalAspect* m_terminalAspect;
|
ProjectExplorer::TerminalAspect* m_terminalAspect;
|
||||||
|
@@ -80,7 +80,8 @@ RunConfiguration *NimRunConfigurationFactory::clone(Target *parent, RunConfigura
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(parent, return nullptr);
|
QTC_ASSERT(parent, return nullptr);
|
||||||
QTC_ASSERT(product, return nullptr);
|
QTC_ASSERT(product, return nullptr);
|
||||||
std::unique_ptr<NimRunConfiguration> result(new NimRunConfiguration(parent, Constants::C_NIMRUNCONFIGURATION_ID));
|
std::unique_ptr<NimRunConfiguration> result(
|
||||||
|
createHelper<NimRunConfiguration>(parent, Constants::C_NIMRUNCONFIGURATION_ID));
|
||||||
return result->fromMap(product->toMap()) ? result.release() : nullptr;
|
return result->fromMap(product->toMap()) ? result.release() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,14 +95,13 @@ bool NimRunConfigurationFactory::canHandle(Target *parent) const
|
|||||||
|
|
||||||
RunConfiguration *NimRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *NimRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
Q_UNUSED(id);
|
return createHelper<NimRunConfiguration>(parent, id);
|
||||||
return new NimRunConfiguration(parent, id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *NimRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *NimRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
Q_UNUSED(map);
|
Q_UNUSED(map);
|
||||||
auto result = new NimRunConfiguration(parent, idFromMap(map));
|
auto result = createHelper<NimRunConfiguration>(parent, idFromMap(map));
|
||||||
result->fromMap(map);
|
result->fromMap(map);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -52,9 +52,10 @@ static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.Bui
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) :
|
BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) :
|
||||||
ProjectConfiguration(target, id),
|
ProjectConfiguration(target),
|
||||||
m_clearSystemEnvironment(false)
|
m_clearSystemEnvironment(false)
|
||||||
{
|
{
|
||||||
|
initialize(id);
|
||||||
Q_ASSERT(target);
|
Q_ASSERT(target);
|
||||||
auto bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_BUILD));
|
auto bsl = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_BUILD));
|
||||||
//: Display name of the build build step list. Used as part of the labels in the project window.
|
//: Display name of the build build step list. Used as part of the labels in the project window.
|
||||||
@@ -76,11 +77,12 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
|
BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *source) :
|
||||||
ProjectConfiguration(target, source),
|
ProjectConfiguration(target),
|
||||||
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
m_clearSystemEnvironment(source->m_clearSystemEnvironment),
|
||||||
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
m_userEnvironmentChanges(source->m_userEnvironmentChanges),
|
||||||
m_buildDirectory(source->m_buildDirectory)
|
m_buildDirectory(source->m_buildDirectory)
|
||||||
{
|
{
|
||||||
|
copyFrom(source);
|
||||||
Q_ASSERT(target);
|
Q_ASSERT(target);
|
||||||
// Do not clone stepLists here, do that in the derived constructor instead
|
// Do not clone stepLists here, do that in the derived constructor instead
|
||||||
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
||||||
|
@@ -112,15 +112,17 @@ static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
||||||
ProjectConfiguration(bsl, id), m_enabled(true)
|
ProjectConfiguration(bsl), m_enabled(true)
|
||||||
{
|
{
|
||||||
|
initialize(id);
|
||||||
Q_ASSERT(bsl);
|
Q_ASSERT(bsl);
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) :
|
BuildStep::BuildStep(BuildStepList *bsl, BuildStep *bs) :
|
||||||
ProjectConfiguration(bsl, bs), m_enabled(bs->m_enabled)
|
ProjectConfiguration(bsl), m_enabled(bs->m_enabled)
|
||||||
{
|
{
|
||||||
|
copyFrom(bs);
|
||||||
Q_ASSERT(bsl);
|
Q_ASSERT(bsl);
|
||||||
setDisplayName(bs->displayName());
|
setDisplayName(bs->displayName());
|
||||||
ctor();
|
ctor();
|
||||||
|
@@ -99,7 +99,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void ctor();
|
void ctor();
|
||||||
|
|
||||||
bool m_enabled;
|
bool m_enabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT BuildStepInfo
|
class PROJECTEXPLORER_EXPORT BuildStepInfo
|
||||||
|
@@ -45,14 +45,16 @@ const char STEPS_PREFIX[] = "ProjectExplorer.BuildStepList.Step.";
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
BuildStepList::BuildStepList(QObject *parent, Core::Id id) :
|
BuildStepList::BuildStepList(QObject *parent, Core::Id id) :
|
||||||
ProjectConfiguration(parent, id)
|
ProjectConfiguration(parent)
|
||||||
{
|
{
|
||||||
Q_ASSERT(parent);
|
Q_ASSERT(parent);
|
||||||
|
initialize(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
||||||
ProjectConfiguration(parent, source)
|
ProjectConfiguration(parent)
|
||||||
{
|
{
|
||||||
|
copyFrom(source);
|
||||||
setDisplayName(source->displayName());
|
setDisplayName(source->displayName());
|
||||||
Q_ASSERT(parent);
|
Q_ASSERT(parent);
|
||||||
// do not clone the steps here:
|
// do not clone the steps here:
|
||||||
|
@@ -82,32 +82,32 @@ private:
|
|||||||
CustomExecutableConfigurationWidget *m_widget;
|
CustomExecutableConfigurationWidget *m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *target)
|
||||||
void CustomExecutableRunConfiguration::ctor()
|
: RunConfiguration(target)
|
||||||
{
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *parent) :
|
|
||||||
RunConfiguration(parent, CUSTOM_EXECUTABLE_ID)
|
|
||||||
{
|
{
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
||||||
addExtraAspect(new ArgumentsAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.Arguments"));
|
addExtraAspect(new ArgumentsAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.Arguments"));
|
||||||
addExtraAspect(new TerminalAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"));
|
addExtraAspect(new TerminalAspect(this, "ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal"));
|
||||||
if (parent->activeBuildConfiguration())
|
}
|
||||||
|
|
||||||
|
void CustomExecutableRunConfiguration::initialize()
|
||||||
|
{
|
||||||
|
RunConfiguration::initialize(CUSTOM_EXECUTABLE_ID);
|
||||||
|
if (target()->activeBuildConfiguration())
|
||||||
m_workingDirectory = Constants::DEFAULT_WORKING_DIR;
|
m_workingDirectory = Constants::DEFAULT_WORKING_DIR;
|
||||||
else
|
else
|
||||||
m_workingDirectory = Constants::DEFAULT_WORKING_DIR_ALTERNATE;
|
m_workingDirectory = Constants::DEFAULT_WORKING_DIR_ALTERNATE;
|
||||||
ctor();
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *parent,
|
void CustomExecutableRunConfiguration::copyFrom(const CustomExecutableRunConfiguration *source)
|
||||||
CustomExecutableRunConfiguration *source) :
|
|
||||||
RunConfiguration(parent, source),
|
|
||||||
m_executable(source->m_executable),
|
|
||||||
m_workingDirectory(source->m_workingDirectory)
|
|
||||||
{
|
{
|
||||||
ctor();
|
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.
|
// Note: Qt4Project deletes all empty customexecrunconfigs for which isConfigured() == false.
|
||||||
@@ -336,7 +336,7 @@ RunConfiguration *
|
|||||||
CustomExecutableRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
CustomExecutableRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
Q_UNUSED(id);
|
Q_UNUSED(id);
|
||||||
return new CustomExecutableRunConfiguration(parent);
|
return createHelper<CustomExecutableRunConfiguration>(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomExecutableRunConfigurationFactory::canRestore(Target *parent,
|
bool CustomExecutableRunConfigurationFactory::canRestore(Target *parent,
|
||||||
@@ -352,7 +352,7 @@ RunConfiguration *
|
|||||||
CustomExecutableRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
CustomExecutableRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
Q_UNUSED(map);
|
Q_UNUSED(map);
|
||||||
return new CustomExecutableRunConfiguration(parent);
|
return createHelper<CustomExecutableRunConfiguration>(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomExecutableRunConfigurationFactory::canClone(Target *parent,
|
bool CustomExecutableRunConfigurationFactory::canClone(Target *parent,
|
||||||
@@ -366,7 +366,7 @@ CustomExecutableRunConfigurationFactory::clone(Target *parent, RunConfiguration
|
|||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
return new CustomExecutableRunConfiguration(parent, static_cast<CustomExecutableRunConfiguration*>(source));
|
return cloneHelper<CustomExecutableRunConfiguration>(parent, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomExecutableRunConfigurationFactory::canHandle(Target *parent) const
|
bool CustomExecutableRunConfigurationFactory::canHandle(Target *parent) const
|
||||||
|
@@ -35,17 +35,15 @@ class CustomExecutableDialog;
|
|||||||
|
|
||||||
namespace Internal { class CustomExecutableConfigurationWidget; }
|
namespace Internal { class CustomExecutableConfigurationWidget; }
|
||||||
|
|
||||||
class CustomExecutableRunConfigurationFactory;
|
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT CustomExecutableRunConfiguration : public RunConfiguration
|
class PROJECTEXPLORER_EXPORT CustomExecutableRunConfiguration : public RunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// the configuration widget needs to setExecutable setWorkingDirectory and setCommandLineArguments
|
// the configuration widget needs to setExecutable setWorkingDirectory and setCommandLineArguments
|
||||||
friend class Internal::CustomExecutableConfigurationWidget;
|
friend class Internal::CustomExecutableConfigurationWidget;
|
||||||
friend class CustomExecutableRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CustomExecutableRunConfiguration(Target *parent);
|
explicit CustomExecutableRunConfiguration(Target *target);
|
||||||
~CustomExecutableRunConfiguration() override;
|
~CustomExecutableRunConfiguration() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,8 +66,8 @@ signals:
|
|||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CustomExecutableRunConfiguration(Target *parent,
|
void initialize();
|
||||||
CustomExecutableRunConfiguration *source);
|
void copyFrom(const CustomExecutableRunConfiguration *source);
|
||||||
virtual bool fromMap(const QVariantMap &map) override;
|
virtual bool fromMap(const QVariantMap &map) override;
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|
||||||
|
@@ -41,8 +41,9 @@ const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildS
|
|||||||
const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConfiguration";
|
const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConfiguration";
|
||||||
|
|
||||||
DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) :
|
DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) :
|
||||||
ProjectConfiguration(target, id)
|
ProjectConfiguration(target)
|
||||||
{
|
{
|
||||||
|
ProjectConfiguration::initialize(id);
|
||||||
Q_ASSERT(target);
|
Q_ASSERT(target);
|
||||||
m_stepList = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_DEPLOY));
|
m_stepList = new BuildStepList(this, Core::Id(Constants::BUILDSTEPS_DEPLOY));
|
||||||
//: Display name of the deploy build step list. Used as part of the labels in the project window.
|
//: Display name of the deploy build step list. Used as part of the labels in the project window.
|
||||||
@@ -53,8 +54,9 @@ DeployConfiguration::DeployConfiguration(Target *target, Core::Id id) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) :
|
DeployConfiguration::DeployConfiguration(Target *target, DeployConfiguration *source) :
|
||||||
ProjectConfiguration(target, source)
|
ProjectConfiguration(target)
|
||||||
{
|
{
|
||||||
|
ProjectConfiguration::copyFrom(source);
|
||||||
Q_ASSERT(target);
|
Q_ASSERT(target);
|
||||||
// Do not clone stepLists here, do that in the derived constructor instead
|
// Do not clone stepLists here, do that in the derived constructor instead
|
||||||
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
||||||
|
@@ -31,16 +31,21 @@ const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id";
|
|||||||
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
|
const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName";
|
||||||
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
|
const char DEFAULT_DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DefaultDisplayName";
|
||||||
|
|
||||||
ProjectConfiguration::ProjectConfiguration(QObject *parent, Core::Id id) : QObject(parent),
|
ProjectConfiguration::ProjectConfiguration(QObject *parent)
|
||||||
m_id(id)
|
: QObject(parent)
|
||||||
{ setObjectName(id.toString()); }
|
{}
|
||||||
|
|
||||||
ProjectConfiguration::ProjectConfiguration(QObject *parent, const ProjectConfiguration *source) :
|
void ProjectConfiguration::initialize(Core::Id id)
|
||||||
QObject(parent),
|
{
|
||||||
m_id(source->m_id),
|
m_id = id;
|
||||||
m_defaultDisplayName(source->m_defaultDisplayName)
|
setObjectName(id.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfiguration::copyFrom(const ProjectConfiguration *source)
|
||||||
{
|
{
|
||||||
Q_ASSERT(source);
|
Q_ASSERT(source);
|
||||||
|
m_id = source->m_id;
|
||||||
|
m_defaultDisplayName = source->m_defaultDisplayName;
|
||||||
m_displayName = tr("Clone of %1").arg(source->displayName());
|
m_displayName = tr("Clone of %1").arg(source->displayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,15 +134,15 @@ bool StatefulProjectConfiguration::isEnabled() const
|
|||||||
return m_isEnabled;
|
return m_isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatefulProjectConfiguration::StatefulProjectConfiguration(QObject *parent, Core::Id id) :
|
StatefulProjectConfiguration::StatefulProjectConfiguration(QObject *parent) :
|
||||||
ProjectConfiguration(parent, id)
|
ProjectConfiguration(parent)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
StatefulProjectConfiguration::StatefulProjectConfiguration(QObject *parent,
|
void StatefulProjectConfiguration::copyFrom(const StatefulProjectConfiguration *source)
|
||||||
const StatefulProjectConfiguration *source) :
|
{
|
||||||
ProjectConfiguration(parent, source),
|
ProjectConfiguration::copyFrom(source);
|
||||||
m_isEnabled(source->m_isEnabled)
|
m_isEnabled = source->m_isEnabled;
|
||||||
{ }
|
}
|
||||||
|
|
||||||
void StatefulProjectConfiguration::setEnabled(bool enabled)
|
void StatefulProjectConfiguration::setEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
|
@@ -74,8 +74,9 @@ signals:
|
|||||||
void toolTipChanged();
|
void toolTipChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ProjectConfiguration(QObject *parent, Core::Id id);
|
ProjectConfiguration(QObject *parent);
|
||||||
ProjectConfiguration(QObject *parent, const ProjectConfiguration *source);
|
void initialize(Core::Id id);
|
||||||
|
void copyFrom(const ProjectConfiguration *source);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::Id m_id;
|
Core::Id m_id;
|
||||||
@@ -100,8 +101,8 @@ signals:
|
|||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StatefulProjectConfiguration(QObject *parent, Core::Id id);
|
StatefulProjectConfiguration(QObject *parent);
|
||||||
StatefulProjectConfiguration(QObject *parent, const StatefulProjectConfiguration *source);
|
void copyFrom(const StatefulProjectConfiguration *source);
|
||||||
|
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
|
@@ -189,26 +189,40 @@ void IRunConfigurationAspect::resetProjectToGlobalSettings()
|
|||||||
|
|
||||||
static std::vector<RunConfiguration::AspectFactory> theAspectFactories;
|
static std::vector<RunConfiguration::AspectFactory> theAspectFactories;
|
||||||
|
|
||||||
RunConfiguration::RunConfiguration(Target *target, Core::Id id) :
|
RunConfiguration::RunConfiguration(Target *target)
|
||||||
StatefulProjectConfiguration(target, id)
|
: StatefulProjectConfiguration(target)
|
||||||
{
|
{
|
||||||
Q_ASSERT(target);
|
Q_ASSERT(target);
|
||||||
ctor();
|
|
||||||
|
|
||||||
for (const AspectFactory &factory : theAspectFactories)
|
connect(target->project(), &Project::parsingStarted,
|
||||||
addExtraAspect(factory(this));
|
this, [this]() { updateEnabledState(); });
|
||||||
}
|
connect(target->project(), &Project::parsingFinished,
|
||||||
|
this, [this]() { updateEnabledState(); });
|
||||||
|
|
||||||
RunConfiguration::RunConfiguration(Target *target, RunConfiguration *source) :
|
connect(target, &Target::addedRunConfiguration,
|
||||||
StatefulProjectConfiguration(target, source)
|
this, [this](const RunConfiguration *rc) {
|
||||||
{
|
if (rc == this)
|
||||||
Q_ASSERT(target);
|
updateEnabledState();
|
||||||
ctor();
|
});
|
||||||
foreach (IRunConfigurationAspect *aspect, source->m_aspects) {
|
|
||||||
IRunConfigurationAspect *clone = aspect->clone(this);
|
connect(this, &RunConfiguration::enabledChanged,
|
||||||
if (clone)
|
this, &RunConfiguration::requestRunActionsUpdate);
|
||||||
m_aspects.append(clone);
|
|
||||||
}
|
Utils::MacroExpander *expander = macroExpander();
|
||||||
|
expander->setDisplayName(tr("Run Settings"));
|
||||||
|
expander->setAccumulating(true);
|
||||||
|
expander->registerSubProvider([target] {
|
||||||
|
BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||||
|
return bc ? bc->macroExpander() : target->macroExpander();
|
||||||
|
});
|
||||||
|
expander->registerPrefix("CurrentRun:Env", tr("Variables in the current run environment"),
|
||||||
|
[this](const QString &var) {
|
||||||
|
const auto envAspect = extraAspect<EnvironmentAspect>();
|
||||||
|
return envAspect ? envAspect->environment().value(var) : QString();
|
||||||
|
});
|
||||||
|
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
|
||||||
|
QCoreApplication::translate("ProjectExplorer", "The currently active run configuration's name."),
|
||||||
|
[this] { return displayName(); }, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration::~RunConfiguration()
|
RunConfiguration::~RunConfiguration()
|
||||||
@@ -216,6 +230,25 @@ RunConfiguration::~RunConfiguration()
|
|||||||
qDeleteAll(m_aspects);
|
qDeleteAll(m_aspects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool RunConfiguration::isActive() const
|
bool RunConfiguration::isActive() const
|
||||||
{
|
{
|
||||||
return target()->isActive() && target()->activeRunConfiguration() == this;
|
return target()->isActive() && target()->activeRunConfiguration() == this;
|
||||||
@@ -248,39 +281,6 @@ void RunConfiguration::addExtraAspect(IRunConfigurationAspect *aspect)
|
|||||||
m_aspects += aspect;
|
m_aspects += aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunConfiguration::ctor()
|
|
||||||
{
|
|
||||||
connect(target()->project(), &Project::parsingStarted,
|
|
||||||
this, [this]() { updateEnabledState(); });
|
|
||||||
connect(target()->project(), &Project::parsingFinished,
|
|
||||||
this, [this]() { updateEnabledState(); });
|
|
||||||
|
|
||||||
connect(target(), &Target::addedRunConfiguration,
|
|
||||||
this, [this](const RunConfiguration *rc) {
|
|
||||||
if (rc == this)
|
|
||||||
updateEnabledState();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(this, &RunConfiguration::enabledChanged,
|
|
||||||
this, &RunConfiguration::requestRunActionsUpdate);
|
|
||||||
|
|
||||||
Utils::MacroExpander *expander = macroExpander();
|
|
||||||
expander->setDisplayName(tr("Run Settings"));
|
|
||||||
expander->setAccumulating(true);
|
|
||||||
expander->registerSubProvider([this]() -> Utils::MacroExpander * {
|
|
||||||
BuildConfiguration *bc = target()->activeBuildConfiguration();
|
|
||||||
return bc ? bc->macroExpander() : target()->macroExpander();
|
|
||||||
});
|
|
||||||
expander->registerPrefix("CurrentRun:Env", tr("Variables in the current run environment"),
|
|
||||||
[this](const QString &var) {
|
|
||||||
const auto envAspect = extraAspect<EnvironmentAspect>();
|
|
||||||
return envAspect ? envAspect->environment().value(var) : QString();
|
|
||||||
});
|
|
||||||
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
|
|
||||||
QCoreApplication::translate("ProjectExplorer", "The currently active run configuration's name."),
|
|
||||||
[this] { return displayName(); }, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns the RunConfiguration of the currently active target
|
* Returns the RunConfiguration of the currently active target
|
||||||
* of the startup project, if such exists, or \c nullptr otherwise.
|
* of the startup project, if such exists, or \c nullptr otherwise.
|
||||||
|
@@ -259,8 +259,11 @@ signals:
|
|||||||
void configurationFinished();
|
void configurationFinished();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RunConfiguration(Target *parent, Core::Id id);
|
friend class IRunConfigurationFactory;
|
||||||
RunConfiguration(Target *parent, RunConfiguration *source);
|
|
||||||
|
RunConfiguration(Target *target);
|
||||||
|
void initialize(Core::Id id);
|
||||||
|
void copyFrom(const RunConfiguration *source);
|
||||||
|
|
||||||
/// convenience function to get current build configuration.
|
/// convenience function to get current build configuration.
|
||||||
BuildConfiguration *activeBuildConfiguration() const;
|
BuildConfiguration *activeBuildConfiguration() const;
|
||||||
@@ -268,8 +271,6 @@ protected:
|
|||||||
virtual void updateEnabledState();
|
virtual void updateEnabledState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ctor();
|
|
||||||
|
|
||||||
static void addAspectFactory(const AspectFactory &aspectFactory);
|
static void addAspectFactory(const AspectFactory &aspectFactory);
|
||||||
|
|
||||||
QList<IRunConfigurationAspect *> m_aspects;
|
QList<IRunConfigurationAspect *> m_aspects;
|
||||||
@@ -297,6 +298,20 @@ public:
|
|||||||
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
|
static IRunConfigurationFactory *find(Target *parent, RunConfiguration *rc);
|
||||||
static QList<IRunConfigurationFactory *> find(Target *parent);
|
static QList<IRunConfigurationFactory *> find(Target *parent);
|
||||||
|
|
||||||
|
template <class RunConfig, typename ...Args>
|
||||||
|
static RunConfig *createHelper(Target *target, Args ...args) {
|
||||||
|
auto runConfig = new RunConfig(target);
|
||||||
|
runConfig->initialize(args...);
|
||||||
|
return runConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class RunConfig>
|
||||||
|
static RunConfig *cloneHelper(Target *target, const RunConfiguration *source) {
|
||||||
|
auto runConfig = new RunConfig(target);
|
||||||
|
runConfig->copyFrom(static_cast<const RunConfig *>(source));
|
||||||
|
return runConfig;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void availableCreationIdsChanged();
|
void availableCreationIdsChanged();
|
||||||
|
|
||||||
|
@@ -115,9 +115,10 @@ QList<DeployConfigurationFactory *> TargetPrivate::deployFactories() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Target::Target(Project *project, Kit *k) :
|
Target::Target(Project *project, Kit *k) :
|
||||||
ProjectConfiguration(project, k->id()),
|
ProjectConfiguration(project),
|
||||||
d(new TargetPrivate(k))
|
d(new TargetPrivate(k))
|
||||||
{
|
{
|
||||||
|
initialize(k->id());
|
||||||
QTC_CHECK(d->m_kit);
|
QTC_CHECK(d->m_kit);
|
||||||
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
||||||
|
|
||||||
|
@@ -151,7 +151,7 @@ class PythonRunConfiguration : public RunConfiguration
|
|||||||
Q_PROPERTY(QString arguments READ arguments)
|
Q_PROPERTY(QString arguments READ arguments)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PythonRunConfiguration(Target *parent, Core::Id id);
|
explicit PythonRunConfiguration(Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
@@ -165,8 +165,10 @@ public:
|
|||||||
void setInterpreter(const QString &interpreter) { m_interpreter = interpreter; }
|
void setInterpreter(const QString &interpreter) { m_interpreter = interpreter; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PythonRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
PythonRunConfiguration(Target *parent, PythonRunConfiguration *source);
|
void initialize(Core::Id id);
|
||||||
|
void copyFrom(const PythonRunConfiguration *source);
|
||||||
|
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|
||||||
QString m_interpreter;
|
QString m_interpreter;
|
||||||
@@ -175,26 +177,31 @@ private:
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
PythonRunConfiguration::PythonRunConfiguration(Target *parent, Core::Id id) :
|
PythonRunConfiguration::PythonRunConfiguration(Target *target)
|
||||||
RunConfiguration(parent, id),
|
: RunConfiguration(target)
|
||||||
m_mainScript(scriptFromId(id))
|
|
||||||
{
|
{
|
||||||
Environment sysEnv = Environment::systemEnvironment();
|
|
||||||
const QString exec = sysEnv.searchInPath("python").toString();
|
|
||||||
m_interpreter = exec.isEmpty() ? "python" : exec;
|
|
||||||
|
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
addExtraAspect(new LocalEnvironmentAspect(this, LocalEnvironmentAspect::BaseEnvironmentModifier()));
|
||||||
addExtraAspect(new ArgumentsAspect(this, "PythonEditor.RunConfiguration.Arguments"));
|
addExtraAspect(new ArgumentsAspect(this, "PythonEditor.RunConfiguration.Arguments"));
|
||||||
addExtraAspect(new TerminalAspect(this, "PythonEditor.RunConfiguration.UseTerminal"));
|
addExtraAspect(new TerminalAspect(this, "PythonEditor.RunConfiguration.UseTerminal"));
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
PythonRunConfiguration::PythonRunConfiguration(Target *parent, PythonRunConfiguration *source) :
|
void PythonRunConfiguration::initialize(Core::Id id)
|
||||||
RunConfiguration(parent, source),
|
|
||||||
m_interpreter(source->interpreter()),
|
|
||||||
m_mainScript(source->m_mainScript)
|
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
RunConfiguration::initialize(id);
|
||||||
|
|
||||||
|
m_mainScript = scriptFromId(id);
|
||||||
|
|
||||||
|
Environment sysEnv = Environment::systemEnvironment();
|
||||||
|
const QString exec = sysEnv.searchInPath("python").toString();
|
||||||
|
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 PythonRunConfiguration::toMap() const
|
||||||
@@ -324,7 +331,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
return new PythonRunConfiguration(parent, static_cast<PythonRunConfiguration*>(source));
|
return cloneHelper<PythonRunConfiguration>(parent, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -332,13 +339,12 @@ private:
|
|||||||
|
|
||||||
RunConfiguration *doCreate(Target *parent, Core::Id id) override
|
RunConfiguration *doCreate(Target *parent, Core::Id id) override
|
||||||
{
|
{
|
||||||
return new PythonRunConfiguration(parent, id);
|
return createHelper<PythonRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *doRestore(Target *parent, const QVariantMap &map) override
|
RunConfiguration *doRestore(Target *parent, const QVariantMap &map) override
|
||||||
{
|
{
|
||||||
Core::Id id(idFromMap(map));
|
return createHelper<PythonRunConfiguration>(parent, idFromMap(map));
|
||||||
return new PythonRunConfiguration(parent, id);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -575,7 +581,7 @@ Project::RestoreResult PythonProject::fromMap(const QVariantMap &map, QString *e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!alreadyPresent)
|
if (!alreadyPresent)
|
||||||
t->addRunConfiguration(new PythonRunConfiguration(t, id));
|
t->addRunConfiguration(IRunConfigurationFactory::createHelper<PythonRunConfiguration>(t, id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -107,44 +107,22 @@ const qbs::ProductData findProduct(const qbs::ProjectData &pro, const QString &u
|
|||||||
// QbsRunConfiguration:
|
// QbsRunConfiguration:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
QbsRunConfiguration::QbsRunConfiguration(Target *parent, Core::Id id) :
|
QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
||||||
RunConfiguration(parent, id),
|
: RunConfiguration(target)
|
||||||
m_uniqueProductName(uniqueProductNameFromId(id)),
|
|
||||||
m_currentInstallStep(0),
|
|
||||||
m_currentBuildStepList(0)
|
|
||||||
{
|
{
|
||||||
auto * const envAspect = new LocalEnvironmentAspect(this,
|
auto envAspect = new LocalEnvironmentAspect(this,
|
||||||
[](RunConfiguration *rc, Environment &env) {
|
[](RunConfiguration *rc, Environment &env) {
|
||||||
static_cast<QbsRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
static_cast<QbsRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
addExtraAspect(envAspect);
|
addExtraAspect(envAspect);
|
||||||
connect(static_cast<QbsProject *>(parent->project()), &Project::parsingFinished, this,
|
connect(static_cast<QbsProject *>(target->project()), &Project::parsingFinished, this,
|
||||||
[envAspect]() { envAspect->buildEnvironmentHasChanged(); });
|
[envAspect]() { envAspect->buildEnvironmentHasChanged(); });
|
||||||
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("Qbs.RunConfiguration.CommandLineArguments")));
|
addExtraAspect(new ArgumentsAspect(this, "Qbs.RunConfiguration.CommandLineArguments"));
|
||||||
addExtraAspect(new WorkingDirectoryAspect(this, QStringLiteral("Qbs.RunConfiguration.WorkingDirectory")));
|
addExtraAspect(new WorkingDirectoryAspect(this, "Qbs.RunConfiguration.WorkingDirectory"));
|
||||||
|
|
||||||
addExtraAspect(new TerminalAspect(this,
|
addExtraAspect(new TerminalAspect(this, "Qbs.RunConfiguration.UseTerminal", isConsoleApplication()));
|
||||||
QStringLiteral("Qbs.RunConfiguration.UseTerminal"),
|
|
||||||
isConsoleApplication()));
|
|
||||||
|
|
||||||
ctor();
|
QbsProject *project = static_cast<QbsProject *>(target->project());
|
||||||
}
|
|
||||||
|
|
||||||
QbsRunConfiguration::QbsRunConfiguration(Target *parent, QbsRunConfiguration *source) :
|
|
||||||
RunConfiguration(parent, source),
|
|
||||||
m_uniqueProductName(source->m_uniqueProductName),
|
|
||||||
m_currentInstallStep(0), // no need to copy this, we will get if from the DC anyway.
|
|
||||||
m_currentBuildStepList(0) // ditto
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QbsRunConfiguration::ctor()
|
|
||||||
{
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
|
|
||||||
QbsProject *project = static_cast<QbsProject *>(target()->project());
|
|
||||||
connect(project, &Project::parsingFinished, this, [this](bool success) {
|
connect(project, &Project::parsingFinished, this, [this](bool success) {
|
||||||
auto terminalAspect = extraAspect<TerminalAspect>();
|
auto terminalAspect = extraAspect<TerminalAspect>();
|
||||||
if (success && !terminalAspect->isUserSet())
|
if (success && !terminalAspect->isUserSet())
|
||||||
@@ -157,8 +135,29 @@ void QbsRunConfiguration::ctor()
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
connect(target(), &Target::activeDeployConfigurationChanged,
|
connect(target, &Target::activeDeployConfigurationChanged,
|
||||||
this, &QbsRunConfiguration::installStepChanged);
|
this, &QbsRunConfiguration::installStepChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QbsRunConfiguration::initialize(Core::Id 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();
|
installStepChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +376,7 @@ bool QbsRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
|||||||
|
|
||||||
RunConfiguration *QbsRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *QbsRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
return new QbsRunConfiguration(parent, id);
|
return createHelper<QbsRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
bool QbsRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||||
@@ -389,7 +388,7 @@ bool QbsRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &m
|
|||||||
|
|
||||||
RunConfiguration *QbsRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *QbsRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return new QbsRunConfiguration(parent, idFromMap(map));
|
return createHelper<QbsRunConfiguration>(parent, idFromMap(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
bool QbsRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
||||||
@@ -401,8 +400,7 @@ RunConfiguration *QbsRunConfigurationFactory::clone(Target *parent, RunConfigura
|
|||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
QbsRunConfiguration *old = static_cast<QbsRunConfiguration *>(source);
|
return cloneHelper<QbsRunConfiguration>(parent, source);
|
||||||
return new QbsRunConfiguration(parent, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Core::Id> QbsRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
|
QList<Core::Id> QbsRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
|
||||||
|
@@ -31,27 +31,14 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QCheckBox;
|
|
||||||
class QLineEdit;
|
|
||||||
class QRadioButton;
|
|
||||||
class QComboBox;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace qbs { class InstallOptions; }
|
namespace qbs { class InstallOptions; }
|
||||||
|
|
||||||
namespace Utils { class PathChooser; }
|
|
||||||
|
|
||||||
namespace ProjectExplorer { class BuildStepList; }
|
namespace ProjectExplorer { class BuildStepList; }
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
class QbsProject;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QbsInstallStep;
|
class QbsInstallStep;
|
||||||
class QbsRunConfigurationFactory;
|
|
||||||
|
|
||||||
class QbsRunConfiguration : public ProjectExplorer::RunConfiguration
|
class QbsRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
@@ -59,10 +46,10 @@ class QbsRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
|
|
||||||
// to change the display name and arguments and set the userenvironmentchanges
|
// to change the display name and arguments and set the userenvironmentchanges
|
||||||
friend class QbsRunConfigurationWidget;
|
friend class QbsRunConfigurationWidget;
|
||||||
friend class QbsRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QbsRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit QbsRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
|
|
||||||
@@ -81,10 +68,11 @@ signals:
|
|||||||
void targetInformationChanged();
|
void targetInformationChanged();
|
||||||
void usingDyldImageSuffixChanged(bool);
|
void usingDyldImageSuffixChanged(bool);
|
||||||
|
|
||||||
protected:
|
|
||||||
QbsRunConfiguration(ProjectExplorer::Target *parent, QbsRunConfiguration *source);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initialize(Core::Id id);
|
||||||
|
void copyFrom(const QbsRunConfiguration *source);
|
||||||
|
|
||||||
void installStepChanged();
|
void installStepChanged();
|
||||||
void installStepToBeRemoved(int pos);
|
void installStepToBeRemoved(int pos);
|
||||||
QString baseWorkingDirectory() const;
|
QString baseWorkingDirectory() const;
|
||||||
@@ -96,8 +84,8 @@ private:
|
|||||||
|
|
||||||
QString m_uniqueProductName;
|
QString m_uniqueProductName;
|
||||||
|
|
||||||
QbsInstallStep *m_currentInstallStep; // We do not take ownership!
|
QbsInstallStep *m_currentInstallStep = nullptr; // We do not take ownership!
|
||||||
ProjectExplorer::BuildStepList *m_currentBuildStepList; // We do not take ownership!
|
ProjectExplorer::BuildStepList *m_currentBuildStepList = nullptr; // We do not take ownership!
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsRunConfigurationWidget : public QWidget
|
class QbsRunConfigurationWidget : public QWidget
|
||||||
|
@@ -54,17 +54,23 @@ static QString pathFromId(const Core::Id id)
|
|||||||
return id.suffixAfter(ANDROID_RC_ID_PREFIX);
|
return id.suffixAfter(ANDROID_RC_ID_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, Core::Id id, const Utils::FileName &path)
|
QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *target)
|
||||||
: AndroidRunConfiguration(parent, id)
|
: AndroidRunConfiguration(target)
|
||||||
, m_proFilePath(path)
|
{}
|
||||||
|
|
||||||
|
void QmakeAndroidRunConfiguration::initialize(Core::Id id, const Utils::FileName &path)
|
||||||
{
|
{
|
||||||
|
AndroidRunConfiguration::initialize(id);
|
||||||
|
m_proFilePath = path;
|
||||||
|
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, QmakeAndroidRunConfiguration *source)
|
void QmakeAndroidRunConfiguration::copyFrom(const QmakeAndroidRunConfiguration *source)
|
||||||
: AndroidRunConfiguration(parent, source)
|
|
||||||
, m_proFilePath(source->m_proFilePath)
|
|
||||||
{
|
{
|
||||||
|
AndroidRunConfiguration::copyFrom(source);
|
||||||
|
m_proFilePath = source->m_proFilePath;
|
||||||
|
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,11 +40,9 @@ namespace Internal {
|
|||||||
class QmakeAndroidRunConfiguration : public Android::AndroidRunConfiguration
|
class QmakeAndroidRunConfiguration : public Android::AndroidRunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class QmakeAndroidRunConfigurationFactory;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
|
explicit QmakeAndroidRunConfiguration(ProjectExplorer::Target *target);
|
||||||
const Utils::FileName &path = Utils::FileName());
|
|
||||||
|
|
||||||
Utils::FileName proFilePath() const;
|
Utils::FileName proFilePath() const;
|
||||||
|
|
||||||
@@ -52,14 +50,15 @@ public:
|
|||||||
|
|
||||||
QString buildSystemTarget() const final;
|
QString buildSystemTarget() const final;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, QmakeAndroidRunConfiguration *source);
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
void initialize(Core::Id id, const Utils::FileName &path = Utils::FileName());
|
||||||
|
void copyFrom(const QmakeAndroidRunConfiguration *source);
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
|
|
||||||
private:
|
|
||||||
QmakeProjectManager::QmakeProject *qmakeProject() const;
|
QmakeProjectManager::QmakeProject *qmakeProject() const;
|
||||||
void ctor();
|
void ctor();
|
||||||
|
|
||||||
|
@@ -93,8 +93,8 @@ QList<Core::Id> QmakeAndroidRunConfigurationFactory::availableCreationIds(Target
|
|||||||
RunConfiguration *QmakeAndroidRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *QmakeAndroidRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
if (parent->project()->rootProjectNode())
|
if (parent->project()->rootProjectNode())
|
||||||
return new QmakeAndroidRunConfiguration(parent, id, pathFromId(id));
|
return createHelper<QmakeAndroidRunConfiguration>(parent, id, pathFromId(id));
|
||||||
return new QmakeAndroidRunConfiguration(parent, id);
|
return createHelper<QmakeAndroidRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *QmakeAndroidRunConfigurationFactory::doRestore(Target *parent,
|
RunConfiguration *QmakeAndroidRunConfigurationFactory::doRestore(Target *parent,
|
||||||
@@ -102,17 +102,15 @@ RunConfiguration *QmakeAndroidRunConfigurationFactory::doRestore(Target *parent,
|
|||||||
{
|
{
|
||||||
Core::Id id = ProjectExplorer::idFromMap(map);
|
Core::Id id = ProjectExplorer::idFromMap(map);
|
||||||
if (parent->project()->rootProjectNode())
|
if (parent->project()->rootProjectNode())
|
||||||
return new QmakeAndroidRunConfiguration(parent, id);
|
return createHelper<QmakeAndroidRunConfiguration>(parent, id);
|
||||||
return new QmakeAndroidRunConfiguration(parent, id);
|
return createHelper<QmakeAndroidRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *QmakeAndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
RunConfiguration *QmakeAndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
|
||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
|
return cloneHelper<QmakeAndroidRunConfiguration>(parent, source);
|
||||||
QmakeAndroidRunConfiguration *old = static_cast<QmakeAndroidRunConfiguration *>(source);
|
|
||||||
return new QmakeAndroidRunConfiguration(parent, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeAndroidRunConfigurationFactory::canHandle(Target *t) const
|
bool QmakeAndroidRunConfigurationFactory::canHandle(Target *t) const
|
||||||
|
@@ -76,27 +76,32 @@ static Utils::FileName pathFromId(Core::Id id)
|
|||||||
// QmakeRunConfiguration
|
// QmakeRunConfiguration
|
||||||
//
|
//
|
||||||
|
|
||||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *parent, Core::Id id) :
|
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target)
|
||||||
RunConfiguration(parent, id),
|
: RunConfiguration(target)
|
||||||
m_proFilePath(pathFromId(id))
|
|
||||||
{
|
{
|
||||||
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
|
addExtraAspect(new LocalEnvironmentAspect(this, [](RunConfiguration *rc, Environment &env) {
|
||||||
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||||
}));
|
}));
|
||||||
addExtraAspect(new ArgumentsAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments")));
|
addExtraAspect(new ArgumentsAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"));
|
||||||
addExtraAspect(new TerminalAspect(this, QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UseTerminal")));
|
addExtraAspect(new TerminalAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.UseTerminal"));
|
||||||
addExtraAspect(new WorkingDirectoryAspect(this,
|
addExtraAspect(new WorkingDirectoryAspect(this, "Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"));
|
||||||
QStringLiteral("Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory")));
|
}
|
||||||
|
|
||||||
|
void DesktopQmakeRunConfiguration::initialize(Core::Id id)
|
||||||
|
{
|
||||||
|
RunConfiguration::initialize(id);
|
||||||
|
m_proFilePath = pathFromId(id);
|
||||||
|
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *parent, DesktopQmakeRunConfiguration *source) :
|
void DesktopQmakeRunConfiguration::copyFrom(const DesktopQmakeRunConfiguration *source)
|
||||||
RunConfiguration(parent, source),
|
|
||||||
m_proFilePath(source->m_proFilePath),
|
|
||||||
m_isUsingDyldImageSuffix(source->m_isUsingDyldImageSuffix),
|
|
||||||
m_isUsingLibrarySearchPath(source->m_isUsingLibrarySearchPath)
|
|
||||||
{
|
{
|
||||||
|
RunConfiguration::copyFrom(source);
|
||||||
|
m_proFilePath = source->m_proFilePath;
|
||||||
|
m_isUsingDyldImageSuffix = source->m_isUsingDyldImageSuffix;
|
||||||
|
m_isUsingLibrarySearchPath = source->m_isUsingLibrarySearchPath;
|
||||||
|
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +469,7 @@ bool DesktopQmakeRunConfigurationFactory::canCreate(Target *parent, Core::Id id)
|
|||||||
|
|
||||||
RunConfiguration *DesktopQmakeRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *DesktopQmakeRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
return new DesktopQmakeRunConfiguration(parent, id);
|
return createHelper<DesktopQmakeRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesktopQmakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
bool DesktopQmakeRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||||
@@ -476,7 +481,7 @@ bool DesktopQmakeRunConfigurationFactory::canRestore(Target *parent, const QVari
|
|||||||
|
|
||||||
RunConfiguration *DesktopQmakeRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *DesktopQmakeRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return new DesktopQmakeRunConfiguration(parent, idFromMap(map));
|
return createHelper<DesktopQmakeRunConfiguration>(parent, idFromMap(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesktopQmakeRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
bool DesktopQmakeRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
|
||||||
@@ -488,8 +493,7 @@ RunConfiguration *DesktopQmakeRunConfigurationFactory::clone(Target *parent, Run
|
|||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
DesktopQmakeRunConfiguration *old = static_cast<DesktopQmakeRunConfiguration *>(source);
|
return cloneHelper<DesktopQmakeRunConfiguration>(parent, source);
|
||||||
return new DesktopQmakeRunConfiguration(parent, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Core::Id> DesktopQmakeRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
|
QList<Core::Id> DesktopQmakeRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
|
||||||
|
@@ -53,10 +53,10 @@ class DesktopQmakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
// to change the display name and arguments and set the userenvironmentchanges
|
// to change the display name and arguments and set the userenvironmentchanges
|
||||||
friend class DesktopQmakeRunConfigurationWidget;
|
friend class DesktopQmakeRunConfigurationWidget;
|
||||||
friend class DesktopQmakeRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DesktopQmakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit DesktopQmakeRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
|
|
||||||
@@ -88,7 +88,9 @@ signals:
|
|||||||
void effectiveTargetInformationChanged();
|
void effectiveTargetInformationChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DesktopQmakeRunConfiguration(ProjectExplorer::Target *parent, DesktopQmakeRunConfiguration *source);
|
void initialize(Core::Id id);
|
||||||
|
void copyFrom(const DesktopQmakeRunConfiguration *source);
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -51,13 +51,43 @@ namespace QmlProjectManager {
|
|||||||
|
|
||||||
const char M_CURRENT_FILE[] = "CurrentFile";
|
const char M_CURRENT_FILE[] = "CurrentFile";
|
||||||
|
|
||||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent, Id id) :
|
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target)
|
||||||
RunConfiguration(parent, id),
|
: RunConfiguration(target)
|
||||||
m_scriptFile(QLatin1String(M_CURRENT_FILE))
|
|
||||||
{
|
{
|
||||||
addExtraAspect(new QmlProjectEnvironmentAspect(this));
|
addExtraAspect(new QmlProjectEnvironmentAspect(this));
|
||||||
|
|
||||||
ctor();
|
// reset default settings in constructor
|
||||||
|
connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
|
||||||
|
this, &QmlProjectRunConfiguration::changeCurrentFile);
|
||||||
|
connect(EditorManager::instance(), &EditorManager::currentDocumentStateChanged,
|
||||||
|
this, [this] { changeCurrentFile(); });
|
||||||
|
|
||||||
|
connect(target, &Target::kitChanged,
|
||||||
|
this, &QmlProjectRunConfiguration::updateEnabledState);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProjectRunConfiguration::initialize(Id id)
|
||||||
|
{
|
||||||
|
RunConfiguration::initialize(id);
|
||||||
|
m_scriptFile = M_CURRENT_FILE;
|
||||||
|
|
||||||
|
if (id == Constants::QML_SCENE_RC_ID)
|
||||||
|
setDisplayName(tr("QML Scene", "QMLRunConfiguration display name."));
|
||||||
|
else
|
||||||
|
setDisplayName(tr("QML Viewer", "QMLRunConfiguration display name."));
|
||||||
|
|
||||||
|
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
|
Runnable QmlProjectRunConfiguration::runnable() const
|
||||||
@@ -72,17 +102,6 @@ Runnable QmlProjectRunConfiguration::runnable() const
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *parent,
|
|
||||||
QmlProjectRunConfiguration *source) :
|
|
||||||
RunConfiguration(parent, source),
|
|
||||||
m_currentFileFilename(source->m_currentFileFilename),
|
|
||||||
m_mainScriptFilename(source->m_mainScriptFilename),
|
|
||||||
m_scriptFile(source->m_scriptFile),
|
|
||||||
m_qmlViewerArgs(source->m_qmlViewerArgs)
|
|
||||||
{
|
|
||||||
ctor();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::disabledReason() const
|
QString QmlProjectRunConfiguration::disabledReason() const
|
||||||
{
|
{
|
||||||
if (mainScript().isEmpty())
|
if (mainScript().isEmpty())
|
||||||
@@ -92,24 +111,6 @@ QString QmlProjectRunConfiguration::disabledReason() const
|
|||||||
return RunConfiguration::disabledReason();
|
return RunConfiguration::disabledReason();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProjectRunConfiguration::ctor()
|
|
||||||
{
|
|
||||||
// reset default settings in constructor
|
|
||||||
connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
|
|
||||||
this, &QmlProjectRunConfiguration::changeCurrentFile);
|
|
||||||
connect(EditorManager::instance(), &EditorManager::currentDocumentStateChanged,
|
|
||||||
this, [this] { changeCurrentFile(); });
|
|
||||||
|
|
||||||
connect(target(), &Target::kitChanged,
|
|
||||||
this, &QmlProjectRunConfiguration::updateEnabledState);
|
|
||||||
|
|
||||||
if (id() == Constants::QML_SCENE_RC_ID)
|
|
||||||
setDisplayName(tr("QML Scene", "QMLRunConfiguration display name."));
|
|
||||||
else
|
|
||||||
setDisplayName(tr("QML Viewer", "QMLRunConfiguration display name."));
|
|
||||||
updateEnabledState();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmlProjectRunConfiguration::executable() const
|
QString QmlProjectRunConfiguration::executable() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *version = qtVersion();
|
QtSupport::BaseQtVersion *version = qtVersion();
|
||||||
|
@@ -40,20 +40,17 @@ namespace QtSupport { class BaseQtVersion; }
|
|||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
class QmlProject;
|
class QmlProject;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal { class QmlProjectRunConfigurationWidget; }
|
||||||
class QmlProjectRunConfigurationFactory;
|
|
||||||
class QmlProjectRunConfigurationWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class Internal::QmlProjectRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
friend class Internal::QmlProjectRunConfigurationWidget;
|
friend class Internal::QmlProjectRunConfigurationWidget;
|
||||||
friend class QmlProject; // to call updateEnabled()
|
friend class QmlProject; // to call updateEnabled()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit QmlProjectRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
|
|
||||||
@@ -79,13 +76,10 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void scriptSourceChanged();
|
void scriptSourceChanged();
|
||||||
|
|
||||||
protected:
|
|
||||||
QmlProjectRunConfiguration(ProjectExplorer::Target *parent,
|
|
||||||
QmlProjectRunConfiguration *source);
|
|
||||||
virtual bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
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 changeCurrentFile(Core::IEditor* = 0);
|
||||||
void updateEnabledState() final;
|
void updateEnabledState() final;
|
||||||
|
@@ -104,7 +104,7 @@ bool QmlProjectRunConfigurationFactory::canCreate(ProjectExplorer::Target *paren
|
|||||||
|
|
||||||
ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id)
|
ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
return new QmlProjectRunConfiguration(parent, id);
|
return createHelper<QmlProjectRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||||
@@ -115,7 +115,7 @@ bool QmlProjectRunConfigurationFactory::canRestore(ProjectExplorer::Target *pare
|
|||||||
ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
|
ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent,
|
||||||
const QVariantMap &map)
|
const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return new QmlProjectRunConfiguration(parent, ProjectExplorer::idFromMap(map));
|
return createHelper<QmlProjectRunConfiguration>(parent, ProjectExplorer::idFromMap(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProjectRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
bool QmlProjectRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
||||||
@@ -128,7 +128,7 @@ ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::clone(Proj
|
|||||||
{
|
{
|
||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
return new QmlProjectRunConfiguration(parent, qobject_cast<QmlProjectRunConfiguration *>(source));
|
return cloneHelper<QmlProjectRunConfiguration>(parent, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProjectRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
bool QmlProjectRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
|
||||||
|
@@ -41,14 +41,19 @@ namespace Internal {
|
|||||||
|
|
||||||
const char QtLibPathKey[] = "Qt4ProjectManager.QnxRunConfiguration.QtLibPath";
|
const char QtLibPathKey[] = "Qt4ProjectManager.QnxRunConfiguration.QtLibPath";
|
||||||
|
|
||||||
QnxRunConfiguration::QnxRunConfiguration(Target *parent, Core::Id id, const QString &targetName)
|
QnxRunConfiguration::QnxRunConfiguration(Target *target)
|
||||||
: RemoteLinuxRunConfiguration(parent, id, targetName)
|
: RemoteLinuxRunConfiguration(target)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void QnxRunConfiguration::initialize(Core::Id id, const QString &targetName)
|
||||||
{
|
{
|
||||||
|
RemoteLinuxRunConfiguration::initialize(id, targetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxRunConfiguration::QnxRunConfiguration(Target *parent, QnxRunConfiguration *source)
|
void QnxRunConfiguration::copyFrom(const QnxRunConfiguration *source)
|
||||||
: RemoteLinuxRunConfiguration(parent, source), m_qtLibPath(source->m_qtLibPath)
|
|
||||||
{
|
{
|
||||||
|
RemoteLinuxRunConfiguration::copyFrom(source);
|
||||||
|
m_qtLibPath = source->m_qtLibPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
Runnable QnxRunConfiguration::runnable() const
|
Runnable QnxRunConfiguration::runnable() const
|
||||||
|
@@ -35,8 +35,7 @@ class QnxRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QnxRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
|
explicit QnxRunConfiguration(ProjectExplorer::Target *target);
|
||||||
const QString &targetName);
|
|
||||||
|
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
|
|
||||||
@@ -44,9 +43,11 @@ public:
|
|||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class QnxRunConfigurationFactory;
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
|
||||||
|
void copyFrom(const QnxRunConfiguration *source);
|
||||||
|
void initialize(Core::Id id, const QString &targetName);
|
||||||
|
|
||||||
QnxRunConfiguration(ProjectExplorer::Target *parent, QnxRunConfiguration *source);
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
QString m_qtLibPath;
|
QString m_qtLibPath;
|
||||||
|
@@ -91,7 +91,7 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::doCreate(ProjectE
|
|||||||
QTC_ASSERT(project, return nullptr);
|
QTC_ASSERT(project, return nullptr);
|
||||||
for (const QmakeProjectManager::QmakeProFile *file : project->applicationProFiles()) {
|
for (const QmakeProjectManager::QmakeProFile *file : project->applicationProFiles()) {
|
||||||
if (file->filePath() == projectFilePath)
|
if (file->filePath() == projectFilePath)
|
||||||
return new QnxRunConfiguration(parent, id, file->targetInformation().target);
|
return createHelper<QnxRunConfiguration>(parent, id, file->targetInformation().target);
|
||||||
}
|
}
|
||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -107,7 +107,7 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::doRestore(Project
|
|||||||
const QVariantMap &map)
|
const QVariantMap &map)
|
||||||
{
|
{
|
||||||
Q_UNUSED(map);
|
Q_UNUSED(map);
|
||||||
return new QnxRunConfiguration(parent, Core::Id(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX), QString());
|
return createHelper<QnxRunConfiguration>(parent, Constants::QNX_QNX_RUNCONFIGURATION_PREFIX, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QnxRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
bool QnxRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const
|
||||||
@@ -120,8 +120,7 @@ ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::clone(ProjectExpl
|
|||||||
if (!canClone(parent, source))
|
if (!canClone(parent, source))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
QnxRunConfiguration *old = static_cast<QnxRunConfiguration *>(source);
|
return cloneHelper<QnxRunConfiguration>(parent, source);
|
||||||
return new QnxRunConfiguration(parent, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QnxRunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const
|
bool QnxRunConfigurationFactory::canHandle(ProjectExplorer::Target *t) const
|
||||||
|
@@ -96,21 +96,29 @@ private:
|
|||||||
Ui::RemoteLinuxCustomRunConfigurationWidget m_ui;
|
Ui::RemoteLinuxCustomRunConfigurationWidget m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent)
|
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *target)
|
||||||
: RunConfiguration(parent, runConfigId())
|
: RunConfiguration(target)
|
||||||
{
|
{
|
||||||
init();
|
addExtraAspect(new RemoteLinuxEnvironmentAspect(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent,
|
void RemoteLinuxCustomRunConfiguration::initialize()
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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
|
bool RemoteLinuxCustomRunConfiguration::isConfigured() const
|
||||||
@@ -167,12 +175,6 @@ QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName()
|
|||||||
return tr("Custom Executable (on Remote Generic Linux Host)");
|
return tr("Custom Executable (on Remote Generic Linux Host)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxCustomRunConfiguration::init()
|
|
||||||
{
|
|
||||||
setDefaultDisplayName(runConfigDefaultDisplayName());
|
|
||||||
addExtraAspect(new RemoteLinuxEnvironmentAspect(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString localExeKey()
|
static QString localExeKey()
|
||||||
{
|
{
|
||||||
return QLatin1String("RemoteLinux.CustomRunConfig.LocalExecutable");
|
return QLatin1String("RemoteLinux.CustomRunConfig.LocalExecutable");
|
||||||
|
@@ -34,9 +34,10 @@ class RemoteLinuxCustomRunConfiguration : public ProjectExplorer::RunConfigurati
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent);
|
explicit RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *target);
|
||||||
RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent,
|
|
||||||
RemoteLinuxCustomRunConfiguration *source);
|
void initialize();
|
||||||
|
void copyFrom(const RemoteLinuxCustomRunConfiguration *source);
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
@@ -57,8 +58,6 @@ public:
|
|||||||
static QString runConfigDefaultDisplayName();
|
static QString runConfigDefaultDisplayName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
|
||||||
|
|
||||||
QString m_localExecutable;
|
QString m_localExecutable;
|
||||||
QString m_remoteExecutable;
|
QString m_remoteExecutable;
|
||||||
QString m_arguments;
|
QString m_arguments;
|
||||||
|
@@ -51,26 +51,12 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
class RemoteLinuxRunConfigurationPrivate {
|
class RemoteLinuxRunConfigurationPrivate
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
RemoteLinuxRunConfigurationPrivate(const QString &targetName)
|
|
||||||
: targetName(targetName),
|
|
||||||
useAlternateRemoteExecutable(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteLinuxRunConfigurationPrivate(const RemoteLinuxRunConfigurationPrivate *other)
|
|
||||||
: targetName(other->targetName),
|
|
||||||
arguments(other->arguments),
|
|
||||||
useAlternateRemoteExecutable(other->useAlternateRemoteExecutable),
|
|
||||||
alternateRemoteExecutable(other->alternateRemoteExecutable),
|
|
||||||
workingDirectory(other->workingDirectory)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString targetName;
|
QString targetName;
|
||||||
QString arguments;
|
QString arguments;
|
||||||
bool useAlternateRemoteExecutable;
|
bool useAlternateRemoteExecutable = false;
|
||||||
QString alternateRemoteExecutable;
|
QString alternateRemoteExecutable;
|
||||||
QString workingDirectory;
|
QString workingDirectory;
|
||||||
};
|
};
|
||||||
@@ -79,20 +65,35 @@ public:
|
|||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, Core::Id id,
|
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target)
|
||||||
const QString &targetName)
|
: RunConfiguration(target), d(new RemoteLinuxRunConfigurationPrivate)
|
||||||
: RunConfiguration(parent, id),
|
|
||||||
d(new RemoteLinuxRunConfigurationPrivate(targetName))
|
|
||||||
{
|
{
|
||||||
init();
|
addExtraAspect(new RemoteLinuxEnvironmentAspect(this));
|
||||||
|
|
||||||
|
connect(target, &Target::deploymentDataChanged,
|
||||||
|
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
||||||
|
connect(target, &Target::applicationTargetsChanged,
|
||||||
|
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
||||||
|
// Handles device changes, etc.
|
||||||
|
connect(target, &Target::kitChanged,
|
||||||
|
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent,
|
void RemoteLinuxRunConfiguration::initialize(Core::Id id, const QString &targetName)
|
||||||
RemoteLinuxRunConfiguration *source)
|
|
||||||
: RunConfiguration(parent, source),
|
|
||||||
d(new RemoteLinuxRunConfigurationPrivate(source->d))
|
|
||||||
{
|
{
|
||||||
init();
|
RunConfiguration::initialize(id);
|
||||||
|
|
||||||
|
d->targetName = targetName;
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoteLinuxRunConfiguration::copyFrom(const RemoteLinuxRunConfiguration *source)
|
||||||
|
{
|
||||||
|
RunConfiguration::copyFrom(source);
|
||||||
|
*d = *source->d;
|
||||||
|
|
||||||
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
|
RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
|
||||||
@@ -100,21 +101,6 @@ RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxRunConfiguration::init()
|
|
||||||
{
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
|
|
||||||
addExtraAspect(new RemoteLinuxEnvironmentAspect(this));
|
|
||||||
|
|
||||||
connect(target(), &Target::deploymentDataChanged,
|
|
||||||
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
|
||||||
connect(target(), &Target::applicationTargetsChanged,
|
|
||||||
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
|
||||||
// Handles device changes, etc.
|
|
||||||
connect(target(), &Target::kitChanged,
|
|
||||||
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget()
|
QWidget *RemoteLinuxRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return new RemoteLinuxRunConfigurationWidget(this);
|
return new RemoteLinuxRunConfigurationWidget(this);
|
||||||
|
@@ -34,21 +34,16 @@
|
|||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
class RemoteLinuxRunConfigurationWidget;
|
class RemoteLinuxRunConfigurationWidget;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal { class RemoteLinuxRunConfigurationPrivate; }
|
||||||
class RemoteLinuxRunConfigurationPrivate;
|
|
||||||
class RemoteLinuxRunConfigurationFactory;
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration
|
class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(RemoteLinuxRunConfiguration)
|
|
||||||
friend class Internal::RemoteLinuxRunConfigurationFactory;
|
|
||||||
friend class RemoteLinuxRunConfigurationWidget;
|
friend class RemoteLinuxRunConfigurationWidget;
|
||||||
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
|
explicit RemoteLinuxRunConfiguration(ProjectExplorer::Target *target);
|
||||||
const QString &targetName);
|
|
||||||
~RemoteLinuxRunConfiguration() override;
|
~RemoteLinuxRunConfiguration() override;
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
@@ -79,14 +74,14 @@ signals:
|
|||||||
void targetInformationChanged() const;
|
void targetInformationChanged() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
|
void initialize(Core::Id id, const QString &targetName);
|
||||||
RemoteLinuxRunConfiguration *source);
|
void copyFrom(const RemoteLinuxRunConfiguration *source);
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleBuildSystemDataUpdated();
|
void handleBuildSystemDataUpdated();
|
||||||
void init();
|
|
||||||
|
|
||||||
Internal::RemoteLinuxRunConfigurationPrivate * const d;
|
Internal::RemoteLinuxRunConfigurationPrivate * const d;
|
||||||
};
|
};
|
||||||
|
@@ -107,27 +107,25 @@ QString RemoteLinuxRunConfigurationFactory::displayNameForId(Core::Id id) const
|
|||||||
RunConfiguration *RemoteLinuxRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *RemoteLinuxRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
if (id == RemoteLinuxCustomRunConfiguration::runConfigId())
|
if (id == RemoteLinuxCustomRunConfiguration::runConfigId())
|
||||||
return new RemoteLinuxCustomRunConfiguration(parent);
|
return createHelper<RemoteLinuxCustomRunConfiguration>(parent);
|
||||||
return new RemoteLinuxRunConfiguration(parent, id, stringFromId(id));
|
return createHelper<RemoteLinuxRunConfiguration>(parent, id, stringFromId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *RemoteLinuxRunConfigurationFactory::doRestore(Target *parent,
|
RunConfiguration *RemoteLinuxRunConfigurationFactory::doRestore(Target *parent,
|
||||||
const QVariantMap &map)
|
const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (idFromMap(map) == RemoteLinuxCustomRunConfiguration::runConfigId())
|
if (idFromMap(map) == RemoteLinuxCustomRunConfiguration::runConfigId())
|
||||||
return new RemoteLinuxCustomRunConfiguration(parent);
|
return createHelper<RemoteLinuxCustomRunConfiguration>(parent);
|
||||||
return new RemoteLinuxRunConfiguration(parent,
|
return createHelper<RemoteLinuxRunConfiguration>(parent, RemoteLinuxRunConfiguration::IdPrefix, QString());
|
||||||
Core::Id(RemoteLinuxRunConfiguration::IdPrefix), QString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent,
|
RunConfiguration *RemoteLinuxRunConfigurationFactory::clone(Target *parent,
|
||||||
RunConfiguration *source)
|
RunConfiguration *source)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(canClone(parent, source), return 0);
|
QTC_ASSERT(canClone(parent, source), return 0);
|
||||||
if (RemoteLinuxCustomRunConfiguration *old = qobject_cast<RemoteLinuxCustomRunConfiguration *>(source))
|
if (qobject_cast<RemoteLinuxCustomRunConfiguration *>(source))
|
||||||
return new RemoteLinuxCustomRunConfiguration(parent, old);
|
return cloneHelper<RemoteLinuxCustomRunConfiguration>(parent, source);
|
||||||
RemoteLinuxRunConfiguration *old = static_cast<RemoteLinuxRunConfiguration *>(source);
|
return cloneHelper<RemoteLinuxRunConfiguration>(parent, source);
|
||||||
return new RemoteLinuxRunConfiguration(parent, old);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteLinuxRunConfigurationFactory::canHandle(const Target *target) const
|
bool RemoteLinuxRunConfigurationFactory::canHandle(const Target *target) const
|
||||||
|
@@ -44,14 +44,16 @@ static QString pathFromId(Core::Id id)
|
|||||||
return id.suffixAfter(Constants::WINRT_RC_PREFIX);
|
return id.suffixAfter(Constants::WINRT_RC_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
WinRtRunConfiguration::WinRtRunConfiguration(ProjectExplorer::Target *parent, Core::Id id)
|
WinRtRunConfiguration::WinRtRunConfiguration(ProjectExplorer::Target *target)
|
||||||
: RunConfiguration(parent, id)
|
: RunConfiguration(target)
|
||||||
, m_proFilePath(pathFromId(id))
|
|
||||||
, m_uninstallAfterStop(false)
|
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Run App Package"));
|
setDisplayName(tr("Run App Package"));
|
||||||
addExtraAspect(new ProjectExplorer::ArgumentsAspect(this,
|
addExtraAspect(new ProjectExplorer::ArgumentsAspect(this, "WinRtRunConfigurationArgumentsId"));
|
||||||
QLatin1String("WinRtRunConfigurationArgumentsId")));
|
}
|
||||||
|
|
||||||
|
void WinRtRunConfiguration::initialize(Core::Id id)
|
||||||
|
{
|
||||||
|
m_proFilePath = pathFromId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
||||||
|
@@ -35,7 +35,7 @@ class WinRtRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WinRtRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
explicit WinRtRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
@@ -53,8 +53,11 @@ signals:
|
|||||||
void uninstallAfterStopChanged(bool);
|
void uninstallAfterStopChanged(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class ProjectExplorer::IRunConfigurationFactory;
|
||||||
|
void initialize(Core::Id id);
|
||||||
|
|
||||||
QString m_proFilePath;
|
QString m_proFilePath;
|
||||||
bool m_uninstallAfterStop;
|
bool m_uninstallAfterStop = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -81,7 +81,7 @@ bool WinRtRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
|
|||||||
|
|
||||||
RunConfiguration *WinRtRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
RunConfiguration *WinRtRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
|
||||||
{
|
{
|
||||||
return new WinRtRunConfiguration(parent, id);
|
return createHelper<WinRtRunConfiguration>(parent, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinRtRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
bool WinRtRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
|
||||||
@@ -94,9 +94,7 @@ bool WinRtRunConfigurationFactory::canRestore(Target *parent, const QVariantMap
|
|||||||
|
|
||||||
RunConfiguration *WinRtRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
RunConfiguration *WinRtRunConfigurationFactory::doRestore(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
RunConfiguration *config = new WinRtRunConfiguration(parent, idFromMap(map));
|
return createHelper<WinRtRunConfiguration>(parent, idFromMap(map));
|
||||||
config->fromMap(map);
|
|
||||||
return config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinRtRunConfigurationFactory::canClone(Target *parent, RunConfiguration *product) const
|
bool WinRtRunConfigurationFactory::canClone(Target *parent, RunConfiguration *product) const
|
||||||
|
Reference in New Issue
Block a user