RunConfiguration: added possibility to clone "Run" configuration

Active "Run" configuration can be clone together with arguments and
"Run Environment"

Change-Id: Iec1a4b0b0702957c30580098e916fe8e665f236e
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent e8dbf1e4
......@@ -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
......@@ -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();
......
......@@ -79,6 +79,7 @@ private slots:
void currentRunConfigurationChanged(int index);
void aboutToShowAddMenu();
void addRunConfiguration();
void cloneRunConfiguration();
void removeRunConfiguration();
void activeRunConfigurationChanged();
void renameRunConfiguration();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment