2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "runsettingspropertiespage.h"
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
#include "buildstepspage.h"
|
|
|
|
|
#include "deployconfiguration.h"
|
|
|
|
|
#include "deployconfigurationmodel.h"
|
2010-04-29 16:52:31 +02:00
|
|
|
#include "runconfigurationmodel.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "runconfiguration.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "target.h"
|
2009-09-29 11:39:55 +02:00
|
|
|
#include "project.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include "ui_runsettingspropertiespage.h"
|
|
|
|
|
|
2009-01-12 15:06:43 +01:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#include <QtCore/QPair>
|
2010-08-18 15:37:26 +02:00
|
|
|
#include <QtGui/QInputDialog>
|
2009-09-29 11:39:55 +02:00
|
|
|
#include <QtGui/QMenu>
|
2010-08-30 12:05:31 +02:00
|
|
|
#include <QtGui/QMessageBox>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
namespace Internal {
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
struct FactoryAndId
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
ProjectExplorer::IRunConfigurationFactory *factory;
|
2010-01-07 18:17:24 +01:00
|
|
|
QString id;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
2008-12-09 15:25:01 +01:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ProjectExplorer
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-16 11:25:28 +01:00
|
|
|
Q_DECLARE_METATYPE(ProjectExplorer::Internal::FactoryAndId)
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace ProjectExplorer::Internal;
|
|
|
|
|
using ExtensionSystem::PluginManager;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
/// RunSettingsPanelFactory
|
|
|
|
|
///
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QString RunSettingsPanelFactory::id() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(RUNSETTINGS_PANEL_ID);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-21 13:46:19 +01:00
|
|
|
QString RunSettingsPanelFactory::displayName() const
|
|
|
|
|
{
|
2010-02-25 10:34:25 +01:00
|
|
|
return QCoreApplication::translate("RunSettingsPanelFactory", "Run Settings");
|
2010-01-21 13:46:19 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool RunSettingsPanelFactory::supports(Target *target)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
Q_UNUSED(target);
|
2008-12-02 12:01:29 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
IPropertiesPanel *RunSettingsPanelFactory::createPanel(Target *target)
|
|
|
|
|
{
|
|
|
|
|
return new RunSettingsPanel(target);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
/// RunSettingsPanel
|
|
|
|
|
///
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
RunSettingsPanel::RunSettingsPanel(Target *target) :
|
|
|
|
|
m_widget(new RunSettingsWidget(target)),
|
2010-02-19 14:16:37 +01:00
|
|
|
m_icon(":/projectexplorer/images/RunSettings.png")
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RunSettingsPanel::~RunSettingsPanel()
|
|
|
|
|
{
|
2009-11-25 15:18:51 +01:00
|
|
|
delete m_widget;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString RunSettingsPanel::displayName() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-24 16:34:22 +01:00
|
|
|
return QCoreApplication::translate("RunSettingsPanel", "Run Settings");
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-11-25 15:57:09 +01:00
|
|
|
QWidget *RunSettingsPanel::widget() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
return m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-25 15:57:09 +01:00
|
|
|
QIcon RunSettingsPanel::icon() const
|
|
|
|
|
{
|
|
|
|
|
return m_icon;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
///
|
|
|
|
|
/// RunSettingsWidget
|
|
|
|
|
///
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
RunSettingsWidget::RunSettingsWidget(Target *target)
|
|
|
|
|
: m_target(target),
|
2010-04-29 16:52:31 +02:00
|
|
|
m_runConfigurationsModel(new RunConfigurationModel(target, this)),
|
2010-07-16 14:00:41 +02:00
|
|
|
m_deployConfigurationModel(new DeployConfigurationModel(target, this)),
|
2010-03-24 15:51:04 +01:00
|
|
|
m_runConfigurationWidget(0),
|
2010-08-04 11:48:50 +02:00
|
|
|
m_runLayout(0),
|
2010-07-16 14:00:41 +02:00
|
|
|
m_deployConfigurationWidget(0),
|
|
|
|
|
m_deployLayout(0),
|
|
|
|
|
m_deploySteps(0),
|
2010-03-24 15:51:04 +01:00
|
|
|
m_ignoreChange(false)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
Q_ASSERT(m_target);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui = new Ui::RunSettingsPropertiesPage;
|
|
|
|
|
m_ui->setupUi(this);
|
2010-07-16 14:00:41 +02:00
|
|
|
|
2010-08-04 11:48:50 +02:00
|
|
|
// deploy part
|
2010-08-18 15:37:26 +02:00
|
|
|
m_ui->deployWidget->setContentsMargins(0, 10, 0, 25);
|
2010-07-16 14:00:41 +02:00
|
|
|
m_deployLayout = new QVBoxLayout(m_ui->deployWidget);
|
|
|
|
|
m_deployLayout->setMargin(0);
|
|
|
|
|
m_deployLayout->setSpacing(5);
|
|
|
|
|
|
|
|
|
|
m_ui->deployConfigurationCombo->setModel(m_deployConfigurationModel);
|
|
|
|
|
m_addDeployMenu = new QMenu(m_ui->addDeployToolButton);
|
|
|
|
|
m_ui->addDeployToolButton->setMenu(m_addDeployMenu);
|
|
|
|
|
|
|
|
|
|
updateDeployConfiguration(m_target->activeDeployConfiguration());
|
|
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
// Some projects may not support deployment, so we need this:
|
2010-07-16 14:00:41 +02:00
|
|
|
m_ui->addDeployToolButton->setEnabled(m_target->activeDeployConfiguration());
|
|
|
|
|
m_ui->deployConfigurationCombo->setEnabled(m_target->activeDeployConfiguration());
|
2010-08-18 15:37:26 +02:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
m_ui->removeDeployToolButton->setEnabled(m_target->deployConfigurations().count() > 1);
|
2010-08-18 15:37:26 +02:00
|
|
|
m_ui->renameDeployButton->setEnabled(m_target->activeDeployConfiguration());
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
connect(m_addDeployMenu, SIGNAL(aboutToShow()),
|
|
|
|
|
this, SLOT(aboutToShowDeployMenu()));
|
|
|
|
|
connect(m_ui->deployConfigurationCombo, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(currentDeployConfigurationChanged(int)));
|
|
|
|
|
connect(m_ui->removeDeployToolButton, SIGNAL(clicked(bool)),
|
|
|
|
|
this, SLOT(removeDeployConfiguration()));
|
2010-08-18 15:37:26 +02:00
|
|
|
connect(m_ui->renameDeployButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(renameDeployConfiguration()));
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
connect(m_target, SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)),
|
|
|
|
|
this, SLOT(activeDeployConfigurationChanged()));
|
|
|
|
|
|
|
|
|
|
// run part
|
2010-08-18 15:37:26 +02:00
|
|
|
m_ui->runWidget->setContentsMargins(0, 10, 0, 25);
|
2010-08-04 11:48:50 +02:00
|
|
|
m_runLayout = new QVBoxLayout(m_ui->runWidget);
|
|
|
|
|
m_runLayout->setMargin(0);
|
|
|
|
|
m_runLayout->setSpacing(5);
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
m_addRunMenu = new QMenu(m_ui->addRunToolButton);
|
|
|
|
|
m_ui->addRunToolButton->setMenu(m_addRunMenu);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui->runConfigurationCombo->setModel(m_runConfigurationsModel);
|
2010-03-24 15:51:04 +01:00
|
|
|
m_ui->runConfigurationCombo->setCurrentIndex(
|
2010-04-29 16:52:31 +02:00
|
|
|
m_runConfigurationsModel->indexFor(m_target->activeRunConfiguration()).row());
|
2010-03-24 15:51:04 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
m_ui->removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
|
2010-08-18 15:37:26 +02:00
|
|
|
m_ui->renameRunButton->setEnabled(m_target->activeRunConfiguration());
|
2010-04-07 14:06:33 +02:00
|
|
|
|
2011-01-24 14:21:52 +01:00
|
|
|
setConfigurationWidget(m_target->activeRunConfiguration());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
connect(m_addRunMenu, SIGNAL(aboutToShow()),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(aboutToShowAddMenu()));
|
|
|
|
|
connect(m_ui->runConfigurationCombo, SIGNAL(currentIndexChanged(int)),
|
2010-02-12 15:15:57 +01:00
|
|
|
this, SLOT(currentRunConfigurationChanged(int)));
|
2010-07-16 14:00:41 +02:00
|
|
|
connect(m_ui->removeRunToolButton, SIGNAL(clicked(bool)),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(removeRunConfiguration()));
|
2010-08-18 15:37:26 +02:00
|
|
|
connect(m_ui->renameRunButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(renameRunConfiguration()));
|
2010-02-08 15:50:06 +01:00
|
|
|
|
|
|
|
|
connect(m_target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
2010-02-01 15:12:38 +01:00
|
|
|
this, SLOT(activeRunConfigurationChanged()));
|
2009-10-29 15:56:24 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// TODO: Add support for custom runner configuration widgets once we have some
|
|
|
|
|
/*
|
2009-09-25 11:35:44 +02:00
|
|
|
QList<IRunControlFactory *> runners = PluginManager::instance()->getObjects<IRunControlFactory>();
|
|
|
|
|
foreach (IRunControlFactory * runner, runners) {
|
2008-12-02 12:01:29 +01:00
|
|
|
if (runner->canRun(activeRunConfiguration))
|
2010-04-16 11:46:47 +02:00
|
|
|
m_ui->layout->addWidget(runner->createConfigurationWidget(activeRunConfiguration));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RunSettingsWidget::~RunSettingsWidget()
|
|
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::aboutToShowAddMenu()
|
|
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
m_addRunMenu->clear();
|
2008-12-09 15:25:01 +01:00
|
|
|
QList<IRunConfigurationFactory *> factories =
|
|
|
|
|
ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
|
|
|
|
|
foreach (IRunConfigurationFactory *factory, factories) {
|
2010-02-08 15:50:06 +01:00
|
|
|
QStringList ids = factory->availableCreationIds(m_target);
|
2010-01-07 18:17:24 +01:00
|
|
|
foreach (const QString &id, ids) {
|
2010-07-16 14:00:41 +02:00
|
|
|
QAction *action = m_addRunMenu->addAction(factory->displayNameForId(id));;
|
2010-01-07 18:17:24 +01:00
|
|
|
FactoryAndId fai;
|
|
|
|
|
fai.factory = factory;
|
|
|
|
|
fai.id = id;
|
2008-12-02 12:01:29 +01:00
|
|
|
QVariant v;
|
2010-01-07 18:17:24 +01:00
|
|
|
v.setValue(fai);
|
2008-12-02 12:01:29 +01:00
|
|
|
action->setData(v);
|
|
|
|
|
connect(action, SIGNAL(triggered()),
|
|
|
|
|
this, SLOT(addRunConfiguration()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::addRunConfiguration()
|
|
|
|
|
{
|
|
|
|
|
QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
if (!act)
|
|
|
|
|
return;
|
2010-01-07 18:17:24 +01:00
|
|
|
FactoryAndId fai = act->data().value<FactoryAndId>();
|
2010-02-08 15:50:06 +01:00
|
|
|
RunConfiguration *newRC = fai.factory->create(m_target, fai.id);
|
2008-12-02 12:01:29 +01:00
|
|
|
if (!newRC)
|
|
|
|
|
return;
|
2010-02-08 15:50:06 +01:00
|
|
|
m_target->addRunConfiguration(newRC);
|
2010-03-24 15:51:04 +01:00
|
|
|
m_target->setActiveRunConfiguration(newRC);
|
2010-07-16 14:00:41 +02:00
|
|
|
m_ui->removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::removeRunConfiguration()
|
|
|
|
|
{
|
2010-03-24 15:51:04 +01:00
|
|
|
RunConfiguration *rc = m_target->activeRunConfiguration();
|
2010-08-30 12:05:31 +02:00
|
|
|
QMessageBox msgBox(QMessageBox::Question, tr("Remove Run Configuration?"),
|
2010-09-10 10:51:43 +02:00
|
|
|
tr("Do you really want to delete the run configuration <b>%1</b>?").arg(rc->displayName()),
|
2010-08-30 12:05:31 +02:00
|
|
|
QMessageBox::Yes|QMessageBox::No, this);
|
|
|
|
|
msgBox.setDefaultButton(QMessageBox::No);
|
|
|
|
|
msgBox.setEscapeButton(QMessageBox::No);
|
|
|
|
|
if (!this || msgBox.exec() == QMessageBox::No)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
m_target->removeRunConfiguration(rc);
|
2010-07-16 14:00:41 +02:00
|
|
|
m_ui->removeRunToolButton->setEnabled(m_target->runConfigurations().size() > 1);
|
2010-08-18 15:37:26 +02:00
|
|
|
m_ui->renameRunButton->setEnabled(m_target->activeRunConfiguration());
|
2010-02-01 15:12:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::activeRunConfigurationChanged()
|
|
|
|
|
{
|
2010-03-24 15:51:04 +01:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
|
|
|
|
QModelIndex actRc = m_runConfigurationsModel->indexFor(m_target->activeRunConfiguration());
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_ui->runConfigurationCombo->setCurrentIndex(actRc.row());
|
2011-02-02 10:49:39 +01:00
|
|
|
setConfigurationWidget(m_runConfigurationsModel->runConfigurationAt(actRc.row()));
|
2010-03-24 15:51:04 +01:00
|
|
|
m_ignoreChange = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
void RunSettingsWidget::renameRunConfiguration()
|
|
|
|
|
{
|
|
|
|
|
bool ok;
|
|
|
|
|
QString name = QInputDialog::getText(this, tr("Rename..."),
|
|
|
|
|
tr("New name for run configuration <b>%1</b>:").
|
|
|
|
|
arg(m_target->activeRunConfiguration()->displayName()),
|
|
|
|
|
QLineEdit::Normal,
|
|
|
|
|
m_target->activeRunConfiguration()->displayName(), &ok);
|
2010-08-19 12:26:21 +02:00
|
|
|
if (!ok || !this)
|
2010-08-18 15:37:26 +02:00
|
|
|
return;
|
|
|
|
|
|
2010-10-04 17:50:55 +02:00
|
|
|
name = uniqueRCName(name);
|
|
|
|
|
if (name.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
m_target->activeRunConfiguration()->setDisplayName(name);
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-12 15:15:57 +01:00
|
|
|
void RunSettingsWidget::currentRunConfigurationChanged(int index)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-03-24 15:51:04 +01:00
|
|
|
if (m_ignoreChange)
|
|
|
|
|
return;
|
2011-01-24 14:21:52 +01:00
|
|
|
|
|
|
|
|
RunConfiguration *selectedRunConfiguration = 0;
|
|
|
|
|
if (index >= 0)
|
|
|
|
|
selectedRunConfiguration = m_runConfigurationsModel->runConfigurationAt(index);
|
2010-03-24 15:51:04 +01:00
|
|
|
|
|
|
|
|
m_ignoreChange = true;
|
|
|
|
|
m_target->setActiveRunConfiguration(selectedRunConfiguration);
|
|
|
|
|
m_ignoreChange = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Update the run configuration configuration widget
|
2011-01-24 14:21:52 +01:00
|
|
|
setConfigurationWidget(selectedRunConfiguration);
|
2009-04-15 14:52:31 +02:00
|
|
|
}
|
2010-07-16 14:00:41 +02:00
|
|
|
|
|
|
|
|
void RunSettingsWidget::currentDeployConfigurationChanged(int index)
|
|
|
|
|
{
|
|
|
|
|
if (index == -1)
|
|
|
|
|
updateDeployConfiguration(0);
|
|
|
|
|
else
|
|
|
|
|
m_target->setActiveDeployConfiguration(m_deployConfigurationModel->deployConfigurationAt(index));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::aboutToShowDeployMenu()
|
|
|
|
|
{
|
|
|
|
|
m_addDeployMenu->clear();
|
|
|
|
|
DeployConfigurationFactory *factory = m_target->deployConfigurationFactory();
|
|
|
|
|
QStringList ids = factory->availableCreationIds(m_target);
|
|
|
|
|
foreach (const QString &id, ids) {
|
|
|
|
|
QAction *action = m_addDeployMenu->addAction(factory->displayNameForId(id));;
|
|
|
|
|
action->setData(QVariant(id));
|
|
|
|
|
connect(action, SIGNAL(triggered()),
|
|
|
|
|
this, SLOT(addDeployConfiguration()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::addDeployConfiguration()
|
|
|
|
|
{
|
|
|
|
|
QAction *act = qobject_cast<QAction *>(sender());
|
|
|
|
|
if (!act)
|
|
|
|
|
return;
|
|
|
|
|
QString id = act->data().toString();
|
|
|
|
|
DeployConfiguration *newDc = m_target->deployConfigurationFactory()->create(m_target, id);
|
|
|
|
|
if (!newDc)
|
|
|
|
|
return;
|
|
|
|
|
m_target->addDeployConfiguration(newDc);
|
|
|
|
|
m_target->setActiveDeployConfiguration(newDc);
|
|
|
|
|
m_ui->removeDeployToolButton->setEnabled(m_target->deployConfigurations().size() > 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::removeDeployConfiguration()
|
|
|
|
|
{
|
|
|
|
|
DeployConfiguration *dc = m_target->activeDeployConfiguration();
|
2010-08-30 12:05:31 +02:00
|
|
|
QMessageBox msgBox(QMessageBox::Question, tr("Remove Deploy Configuration?"),
|
2010-09-13 16:51:18 +02:00
|
|
|
tr("Do you really want to delete deploy configuration <b>%1</b>?").arg(dc->displayName()),
|
2010-08-30 12:05:31 +02:00
|
|
|
QMessageBox::Yes|QMessageBox::No, this);
|
|
|
|
|
msgBox.setDefaultButton(QMessageBox::No);
|
|
|
|
|
msgBox.setEscapeButton(QMessageBox::No);
|
|
|
|
|
if (!this || msgBox.exec() == QMessageBox::No)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
m_target->removeDeployConfiguration(dc);
|
|
|
|
|
m_ui->removeDeployToolButton->setEnabled(m_target->deployConfigurations().size() > 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunSettingsWidget::activeDeployConfigurationChanged()
|
|
|
|
|
{
|
|
|
|
|
updateDeployConfiguration(m_target->activeDeployConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
void RunSettingsWidget::renameDeployConfiguration()
|
|
|
|
|
{
|
|
|
|
|
bool ok;
|
|
|
|
|
QString name = QInputDialog::getText(this, tr("Rename..."),
|
|
|
|
|
tr("New name for deploy configuration <b>%1</b>:").
|
|
|
|
|
arg(m_target->activeDeployConfiguration()->displayName()),
|
|
|
|
|
QLineEdit::Normal,
|
|
|
|
|
m_target->activeDeployConfiguration()->displayName(), &ok);
|
2010-08-19 12:26:21 +02:00
|
|
|
if (!ok || !this)
|
2010-08-18 15:37:26 +02:00
|
|
|
return;
|
|
|
|
|
|
2010-10-04 17:50:55 +02:00
|
|
|
name = uniqueDCName(name);
|
|
|
|
|
if (name.isEmpty())
|
|
|
|
|
return;
|
2010-08-18 15:37:26 +02:00
|
|
|
m_target->activeDeployConfiguration()->setDisplayName(name);
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
void RunSettingsWidget::updateDeployConfiguration(DeployConfiguration *dc)
|
|
|
|
|
{
|
|
|
|
|
delete m_deployConfigurationWidget;
|
|
|
|
|
m_deployConfigurationWidget = 0;
|
|
|
|
|
delete m_deploySteps;
|
|
|
|
|
m_deploySteps = 0;
|
|
|
|
|
|
|
|
|
|
m_ui->deployConfigurationCombo->setCurrentIndex(-1);
|
|
|
|
|
|
|
|
|
|
if (!dc)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QModelIndex actDc = m_deployConfigurationModel->indexFor(dc);
|
|
|
|
|
m_ui->deployConfigurationCombo->setCurrentIndex(actDc.row());
|
|
|
|
|
|
|
|
|
|
m_deployConfigurationWidget = dc->configurationWidget();
|
|
|
|
|
if (m_deployConfigurationWidget) {
|
|
|
|
|
m_deployConfigurationWidget->init(dc);
|
|
|
|
|
m_deployLayout->addWidget(m_deployConfigurationWidget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_deploySteps = new BuildStepListWidget;
|
|
|
|
|
m_deploySteps->init(dc->stepList());
|
|
|
|
|
m_deployLayout->addWidget(m_deploySteps);
|
|
|
|
|
}
|
2010-10-04 17:50:55 +02:00
|
|
|
|
2011-01-24 14:21:52 +01:00
|
|
|
void RunSettingsWidget::setConfigurationWidget(RunConfiguration *rc)
|
|
|
|
|
{
|
|
|
|
|
delete m_runConfigurationWidget;
|
|
|
|
|
m_runConfigurationWidget = 0;
|
|
|
|
|
if (!rc)
|
|
|
|
|
return;
|
|
|
|
|
m_runConfigurationWidget = m_target->activeRunConfiguration()->createConfigurationWidget();
|
|
|
|
|
m_runLayout->addWidget(m_runConfigurationWidget);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 17:50:55 +02:00
|
|
|
QString RunSettingsWidget::uniqueDCName(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
QString result = name.trimmed();
|
|
|
|
|
if (!result.isEmpty()) {
|
|
|
|
|
QStringList dcNames;
|
|
|
|
|
foreach (DeployConfiguration *dc, m_target->deployConfigurations()) {
|
|
|
|
|
if (dc == m_target->activeDeployConfiguration())
|
|
|
|
|
continue;
|
|
|
|
|
dcNames.append(dc->displayName());
|
|
|
|
|
}
|
|
|
|
|
result = Project::makeUnique(result, dcNames);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString RunSettingsWidget::uniqueRCName(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
QString result = name.trimmed();
|
|
|
|
|
if (!result.isEmpty()) {
|
|
|
|
|
QStringList rcNames;
|
|
|
|
|
foreach (RunConfiguration *rc, m_target->runConfigurations()) {
|
|
|
|
|
if (rc == m_target->activeRunConfiguration())
|
|
|
|
|
continue;
|
|
|
|
|
rcNames.append(rc->displayName());
|
|
|
|
|
}
|
|
|
|
|
result = Project::makeUnique(result, rcNames);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|