summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2014-01-14 15:13:26 +0100
committerPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2014-01-17 07:24:59 +0100
commit1e9433e779be54d3c30041f6d3f007cc829043a5 (patch)
treebebeee437733f9383439889dd62adece352eddd7
parente8dbf1e4371eb7b3c8311aabecde02b99418b230 (diff)
downloadqt-creator-1e9433e779be54d3c30041f6d3f007cc829043a5.tar.gz
RunConfiguration: added possibility to clone "Run" configuration
Active "Run" configuration can be clone together with arguments and "Run Environment" Change-Id: Iec1a4b0b0702957c30580098e916fe8e665f236e Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
-rw-r--r--src/plugins/projectexplorer/localenvironmentaspect.cpp4
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.cpp21
-rw-r--r--src/plugins/projectexplorer/runsettingspropertiespage.h1
3 files changed, 25 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/localenvironmentaspect.cpp b/src/plugins/projectexplorer/localenvironmentaspect.cpp
index 7de671ec6f..24e3b4f372 100644
--- a/src/plugins/projectexplorer/localenvironmentaspect.cpp
+++ b/src/plugins/projectexplorer/localenvironmentaspect.cpp
@@ -97,7 +97,9 @@ LocalEnvironmentAspect::LocalEnvironmentAspect(RunConfiguration *parent) :
LocalEnvironmentAspect *LocalEnvironmentAspect::create(RunConfiguration *parent) const
{
- return new LocalEnvironmentAspect(parent);
+ LocalEnvironmentAspect *result = new LocalEnvironmentAspect(parent);
+ result->setUserEnvironmentChanges(userEnvironmentChanges());
+ return result;
}
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
index de4f2af026..0d88239ab1 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp
@@ -282,6 +282,10 @@ static bool actionLessThan(const QAction *action1, const QAction *action2)
void RunSettingsWidget::aboutToShowAddMenu()
{
m_addRunMenu->clear();
+ if (m_target->activeRunConfiguration()) {
+ m_addRunMenu->addAction(tr("&Clone Selected"),
+ this, SLOT(cloneRunConfiguration()));
+ }
QList<IRunConfigurationFactory *> factories =
ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
@@ -322,6 +326,23 @@ void RunSettingsWidget::addRunConfiguration()
m_removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
}
+void RunSettingsWidget::cloneRunConfiguration()
+{
+ RunConfiguration* activeRunConfiguration = m_target->activeRunConfiguration();
+ IRunConfigurationFactory *factory = IRunConfigurationFactory::find(m_target,
+ activeRunConfiguration);
+ if (!factory)
+ return;
+
+ RunConfiguration *newRc = factory->clone(m_target, activeRunConfiguration);
+ if (!newRc)
+ return;
+
+ newRc->setDisplayName(activeRunConfiguration->displayName());
+ m_target->addRunConfiguration(newRc);
+ m_target->setActiveRunConfiguration(newRc);
+}
+
void RunSettingsWidget::removeRunConfiguration()
{
RunConfiguration *rc = m_target->activeRunConfiguration();
diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h
index c48d7d001d..f1cad07038 100644
--- a/src/plugins/projectexplorer/runsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/runsettingspropertiespage.h
@@ -79,6 +79,7 @@ private slots:
void currentRunConfigurationChanged(int index);
void aboutToShowAddMenu();
void addRunConfiguration();
+ void cloneRunConfiguration();
void removeRunConfiguration();
void activeRunConfigurationChanged();
void renameRunConfiguration();