2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02: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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "buildsettingspropertiespage.h"
|
|
|
|
|
#include "buildstepspage.h"
|
|
|
|
|
#include "project.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "target.h"
|
2009-09-21 17:54:02 +02:00
|
|
|
#include "buildconfiguration.h"
|
2010-04-29 16:52:31 +02:00
|
|
|
#include "buildconfigurationmodel.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-29 15:17:21 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2011-10-24 13:10:38 +00:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
|
|
|
|
#include <projectexplorer/buildmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMargins>
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QInputDialog>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QMenu>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QVBoxLayout>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace ProjectExplorer::Internal;
|
|
|
|
|
|
|
|
|
|
///
|
2009-11-30 16:44:22 +01:00
|
|
|
// BuildSettingsPanelFactory
|
2008-12-02 12:01:29 +01:00
|
|
|
///
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QString BuildSettingsPanelFactory::id() const
|
|
|
|
|
{
|
|
|
|
|
return QLatin1String(BUILDSETTINGS_PANEL_ID);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-21 13:46:19 +01:00
|
|
|
QString BuildSettingsPanelFactory::displayName() const
|
|
|
|
|
{
|
2010-02-24 16:34:22 +01:00
|
|
|
return QCoreApplication::translate("BuildSettingsPanelFactory", "Build Settings");
|
2010-01-21 13:46:19 +01:00
|
|
|
}
|
|
|
|
|
|
2011-10-28 10:15:04 +00:00
|
|
|
int BuildSettingsPanelFactory::priority() const
|
|
|
|
|
{
|
|
|
|
|
return 10;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool BuildSettingsPanelFactory::supports(Target *target)
|
|
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
return IBuildConfigurationFactory::find(target);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 13:32:30 +02:00
|
|
|
PropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2011-04-14 13:32:30 +02:00
|
|
|
PropertiesPanel *panel = new PropertiesPanel;
|
2011-08-16 10:45:23 +02:00
|
|
|
QWidget *w = new QWidget();
|
|
|
|
|
QVBoxLayout *l = new QVBoxLayout(w);
|
|
|
|
|
QWidget *b = new BuildSettingsWidget(target);
|
|
|
|
|
l->addWidget(b);
|
|
|
|
|
l->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
|
|
|
l->setContentsMargins(QMargins());
|
|
|
|
|
panel->setWidget(w);
|
2012-01-09 16:30:33 +01:00
|
|
|
panel->setIcon(QIcon(QLatin1String(":/projectexplorer/images/BuildSettings.png")));
|
2011-04-14 13:32:30 +02:00
|
|
|
panel->setDisplayName(QCoreApplication::translate("BuildSettingsPanel", "Build Settings"));
|
|
|
|
|
return panel;
|
2009-11-25 15:57:09 +01:00
|
|
|
}
|
|
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
///
|
2009-11-30 16:44:22 +01:00
|
|
|
// BuildSettingsWidget
|
2009-07-16 15:33:19 +02:00
|
|
|
///
|
|
|
|
|
|
2009-11-30 16:44:22 +01:00
|
|
|
BuildSettingsWidget::~BuildSettingsWidget()
|
2009-07-16 15:33:19 +02:00
|
|
|
{
|
|
|
|
|
clear();
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
BuildSettingsWidget::BuildSettingsWidget(Target *target) :
|
|
|
|
|
m_target(target),
|
2010-05-21 14:29:11 +02:00
|
|
|
m_buildConfiguration(0)
|
2009-07-16 15:33:19 +02:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
Q_ASSERT(m_target);
|
2009-07-16 15:33:19 +02:00
|
|
|
|
|
|
|
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
2009-11-30 16:44:22 +01:00
|
|
|
vbox->setContentsMargins(0, 0, 0, 0);
|
2009-10-29 15:17:21 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!IBuildConfigurationFactory::find(m_target)) {
|
2011-09-28 15:47:34 +02:00
|
|
|
QLabel *noSettingsLabel = new QLabel(this);
|
2010-05-14 15:45:43 +02:00
|
|
|
noSettingsLabel->setText(tr("No build settings available"));
|
2011-09-28 15:47:34 +02:00
|
|
|
QFont f = noSettingsLabel->font();
|
|
|
|
|
f.setPointSizeF(f.pointSizeF() * 1.2);
|
|
|
|
|
noSettingsLabel->setFont(f);
|
2010-02-08 15:50:06 +01:00
|
|
|
vbox->addWidget(noSettingsLabel);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-29 15:17:21 +01:00
|
|
|
{ // Edit Build Configuration row
|
|
|
|
|
QHBoxLayout *hbox = new QHBoxLayout();
|
2010-05-21 14:29:11 +02:00
|
|
|
hbox->setContentsMargins(0, 0, 0, 0);
|
2010-05-14 15:45:43 +02:00
|
|
|
hbox->addWidget(new QLabel(tr("Edit build configuration:"), this));
|
2009-10-29 15:17:21 +01:00
|
|
|
m_buildConfigurationComboBox = new QComboBox(this);
|
|
|
|
|
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
2010-04-29 16:52:31 +02:00
|
|
|
m_buildConfigurationComboBox->setModel(new BuildConfigurationModel(m_target, this));
|
2009-10-29 15:17:21 +01:00
|
|
|
hbox->addWidget(m_buildConfigurationComboBox);
|
|
|
|
|
|
|
|
|
|
m_addButton = new QPushButton(this);
|
|
|
|
|
m_addButton->setText(tr("Add"));
|
|
|
|
|
m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
hbox->addWidget(m_addButton);
|
2009-11-30 16:44:22 +01:00
|
|
|
m_addButtonMenu = new QMenu(this);
|
|
|
|
|
m_addButton->setMenu(m_addButtonMenu);
|
2009-10-29 15:17:21 +01:00
|
|
|
|
|
|
|
|
m_removeButton = new QPushButton(this);
|
|
|
|
|
m_removeButton->setText(tr("Remove"));
|
|
|
|
|
m_removeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
hbox->addWidget(m_removeButton);
|
2010-02-12 15:15:57 +01:00
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
m_renameButton = new QPushButton(this);
|
2011-11-02 12:42:48 +01:00
|
|
|
m_renameButton->setText(tr("Rename..."));
|
2010-08-18 15:37:26 +02:00
|
|
|
m_renameButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
hbox->addWidget(m_renameButton);
|
|
|
|
|
|
2009-10-29 15:17:21 +01:00
|
|
|
hbox->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
|
|
|
|
vbox->addLayout(hbox);
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
m_buildConfiguration = m_target->activeBuildConfiguration();
|
2010-04-29 16:52:31 +02:00
|
|
|
BuildConfigurationModel *model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model());
|
|
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(model->indexFor(m_buildConfiguration).row());
|
2009-09-17 13:59:10 +02:00
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
updateAddButtonMenu();
|
|
|
|
|
updateBuildSettings();
|
|
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
connect(m_buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(currentIndexChanged(int)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
connect(m_removeButton, SIGNAL(clicked()),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(deleteConfiguration()));
|
2009-09-17 13:59:10 +02:00
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
connect(m_renameButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(renameConfiguration()));
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
connect(m_target, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
|
2010-02-12 15:15:57 +01:00
|
|
|
this, SLOT(updateActiveConfiguration()));
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
connect(m_target, SIGNAL(kitChanged()), this, SLOT(updateAddButtonMenu()));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2012-11-08 18:02:50 +01:00
|
|
|
void BuildSettingsWidget::addSubWidget(NamedWidget *widget)
|
2009-11-30 16:44:22 +01:00
|
|
|
{
|
2010-05-21 14:29:11 +02:00
|
|
|
widget->setContentsMargins(0, 10, 0, 0);
|
2009-11-30 16:44:22 +01:00
|
|
|
|
|
|
|
|
QLabel *label = new QLabel(this);
|
2010-07-16 14:00:41 +02:00
|
|
|
label->setText(widget->displayName());
|
|
|
|
|
connect(widget, SIGNAL(displayNameChanged(QString)),
|
|
|
|
|
label, SLOT(setText(QString)));
|
2009-11-30 16:44:22 +01:00
|
|
|
QFont f = label->font();
|
|
|
|
|
f.setBold(true);
|
|
|
|
|
f.setPointSizeF(f.pointSizeF() * 1.2);
|
|
|
|
|
label->setFont(f);
|
|
|
|
|
|
2010-05-21 14:29:11 +02:00
|
|
|
label->setContentsMargins(0, 10, 0, 0);
|
2009-11-30 16:44:22 +01:00
|
|
|
|
|
|
|
|
layout()->addWidget(label);
|
|
|
|
|
layout()->addWidget(widget);
|
|
|
|
|
|
|
|
|
|
m_labels.append(label);
|
|
|
|
|
m_subWidgets.append(widget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildSettingsWidget::clear()
|
|
|
|
|
{
|
|
|
|
|
qDeleteAll(m_subWidgets);
|
|
|
|
|
m_subWidgets.clear();
|
|
|
|
|
qDeleteAll(m_labels);
|
|
|
|
|
m_labels.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-08 18:02:50 +01:00
|
|
|
QList<NamedWidget *> BuildSettingsWidget::subWidgets() const
|
2009-11-30 16:44:22 +01:00
|
|
|
{
|
|
|
|
|
return m_subWidgets;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-28 17:30:11 +02:00
|
|
|
void BuildSettingsWidget::updateAddButtonMenu()
|
2009-09-28 15:02:12 +02:00
|
|
|
{
|
2009-09-28 17:30:11 +02:00
|
|
|
m_addButtonMenu->clear();
|
2010-06-11 13:41:07 +10:00
|
|
|
if (m_target) {
|
|
|
|
|
if (m_target->activeBuildConfiguration()) {
|
|
|
|
|
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
|
|
|
|
this, SLOT(cloneConfiguration()));
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
IBuildConfigurationFactory * factory = IBuildConfigurationFactory::find(m_target);
|
2012-06-24 20:30:02 +03:00
|
|
|
if (!factory)
|
|
|
|
|
return;
|
2012-04-24 15:49:09 +02:00
|
|
|
foreach (Core::Id id, factory->availableCreationIds(m_target)) {
|
|
|
|
|
QAction *action = m_addButtonMenu->addAction(factory->displayNameForId(id), this, SLOT(createConfiguration()));
|
|
|
|
|
action->setData(QVariant::fromValue(id));
|
2009-09-28 15:02:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void BuildSettingsWidget::updateBuildSettings()
|
|
|
|
|
{
|
2009-11-30 16:44:22 +01:00
|
|
|
clear();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
// update buttons
|
2010-02-08 15:50:06 +01:00
|
|
|
m_removeButton->setEnabled(m_target->buildConfigurations().size() > 1);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-11-08 16:58:49 +01:00
|
|
|
if (!m_buildConfiguration)
|
|
|
|
|
return;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Add pages
|
2012-11-08 18:02:50 +01:00
|
|
|
NamedWidget *generalConfigWidget = m_buildConfiguration->createConfigWidget();
|
2013-01-30 18:11:59 +01:00
|
|
|
if (generalConfigWidget)
|
|
|
|
|
addSubWidget(generalConfigWidget);
|
2009-07-16 15:33:19 +02:00
|
|
|
|
2012-11-08 17:35:59 +01:00
|
|
|
addSubWidget(new BuildStepsPage(m_buildConfiguration, Core::Id(Constants::BUILDSTEPS_BUILD)));
|
|
|
|
|
addSubWidget(new BuildStepsPage(m_buildConfiguration, Core::Id(Constants::BUILDSTEPS_CLEAN)));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-11-08 18:02:50 +01:00
|
|
|
QList<NamedWidget *> subConfigWidgets = m_buildConfiguration->createSubConfigWidgets();
|
|
|
|
|
foreach (NamedWidget *subConfigWidget, subConfigWidgets)
|
2010-07-16 14:00:41 +02:00
|
|
|
addSubWidget(subConfigWidget);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
void BuildSettingsWidget::currentIndexChanged(int index)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-04-29 16:52:31 +02:00
|
|
|
BuildConfigurationModel *model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model());
|
|
|
|
|
BuildConfiguration *buildConfiguration = model->buildConfigurationAt(index);
|
2010-03-12 14:58:51 +01:00
|
|
|
m_target->setActiveBuildConfiguration(buildConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
void BuildSettingsWidget::updateActiveConfiguration()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-03-12 14:58:51 +01:00
|
|
|
if (!m_buildConfiguration || m_buildConfiguration == m_target->activeBuildConfiguration())
|
2010-02-08 15:50:06 +01:00
|
|
|
return;
|
|
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
m_buildConfiguration = m_target->activeBuildConfiguration();
|
|
|
|
|
|
2010-04-29 16:52:31 +02:00
|
|
|
BuildConfigurationModel *model = static_cast<BuildConfigurationModel *>(m_buildConfigurationComboBox->model());
|
|
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(model->indexFor(m_buildConfiguration).row());
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2012-11-08 16:58:49 +01:00
|
|
|
updateBuildSettings();
|
2009-10-29 15:17:21 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void BuildSettingsWidget::createConfiguration()
|
|
|
|
|
{
|
2009-09-28 15:02:12 +02:00
|
|
|
QAction *action = qobject_cast<QAction *>(sender());
|
2012-03-15 17:17:40 +01:00
|
|
|
Core::Id id = action->data().value<Core::Id>();
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(m_target);
|
|
|
|
|
if (!factory)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
BuildConfiguration *bc = factory->create(m_target, id);
|
|
|
|
|
if (!bc)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_target->addBuildConfiguration(bc);
|
|
|
|
|
|
|
|
|
|
QTC_CHECK(bc->id() == id);
|
|
|
|
|
m_target->setActiveBuildConfiguration(bc);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildSettingsWidget::cloneConfiguration()
|
|
|
|
|
{
|
2010-03-12 14:58:51 +01:00
|
|
|
cloneConfiguration(m_buildConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildSettingsWidget::deleteConfiguration()
|
|
|
|
|
{
|
2010-03-12 14:58:51 +01:00
|
|
|
deleteConfiguration(m_buildConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-10-04 17:50:55 +02:00
|
|
|
QString BuildSettingsWidget::uniqueName(const QString & name)
|
|
|
|
|
{
|
|
|
|
|
QString result = name.trimmed();
|
|
|
|
|
if (!result.isEmpty()) {
|
|
|
|
|
QStringList bcNames;
|
|
|
|
|
foreach (BuildConfiguration *bc, m_target->buildConfigurations()) {
|
|
|
|
|
if (bc == m_buildConfiguration)
|
|
|
|
|
continue;
|
|
|
|
|
bcNames.append(bc->displayName());
|
|
|
|
|
}
|
|
|
|
|
result = Project::makeUnique(result, bcNames);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
void BuildSettingsWidget::renameConfiguration()
|
|
|
|
|
{
|
|
|
|
|
bool ok;
|
|
|
|
|
QString name = QInputDialog::getText(this, tr("Rename..."),
|
|
|
|
|
tr("New name for build configuration <b>%1</b>:").
|
|
|
|
|
arg(m_buildConfiguration->displayName()),
|
|
|
|
|
QLineEdit::Normal,
|
|
|
|
|
m_buildConfiguration->displayName(), &ok);
|
2011-09-28 16:38:57 +02:00
|
|
|
if (!ok)
|
2010-08-18 15:37:26 +02:00
|
|
|
return;
|
|
|
|
|
|
2010-10-04 17:50:55 +02:00
|
|
|
name = uniqueName(name);
|
|
|
|
|
if (name.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2010-08-18 15:37:26 +02:00
|
|
|
m_buildConfiguration->setDisplayName(name);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:36:31 +01:00
|
|
|
void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfiguration)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!sourceConfiguration)
|
|
|
|
|
return;
|
|
|
|
|
IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(m_target);
|
|
|
|
|
if (!factory)
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
|
2010-08-19 12:26:21 +02:00
|
|
|
//: Title of a the cloned BuildConfiguration window, text of the window
|
2010-10-04 17:50:55 +02:00
|
|
|
QString name = uniqueName(QInputDialog::getText(this, tr("Clone Configuration"), tr("New configuration name:")));
|
|
|
|
|
if (name.isEmpty())
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
BuildConfiguration *bc = factory->clone(m_target, sourceConfiguration);
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!bc)
|
2010-01-18 12:11:04 +01:00
|
|
|
return;
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2010-10-04 17:50:55 +02:00
|
|
|
bc->setDisplayName(name);
|
2010-04-15 13:54:32 +02:00
|
|
|
m_target->addBuildConfiguration(bc);
|
|
|
|
|
m_target->setActiveBuildConfiguration(bc);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:36:31 +01:00
|
|
|
void BuildSettingsWidget::deleteConfiguration(BuildConfiguration *deleteConfiguration)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!deleteConfiguration ||
|
|
|
|
|
m_target->buildConfigurations().size() <= 1)
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
|
2013-09-05 14:36:20 +02:00
|
|
|
if (BuildManager::isBuilding(deleteConfiguration)) {
|
2011-10-24 13:10:38 +00:00
|
|
|
QMessageBox box;
|
|
|
|
|
QPushButton *closeAnyway = box.addButton(tr("Cancel Build && Remove Build Configuration"), QMessageBox::AcceptRole);
|
|
|
|
|
QPushButton *cancelClose = box.addButton(tr("Do Not Remove"), QMessageBox::RejectRole);
|
|
|
|
|
box.setDefaultButton(cancelClose);
|
|
|
|
|
box.setWindowTitle(tr("Remove Build Configuration %1?").arg(deleteConfiguration->displayName()));
|
|
|
|
|
box.setText(tr("The build configuration <b>%1</b> is currently being built.").arg(deleteConfiguration->displayName()));
|
|
|
|
|
box.setInformativeText(tr("Do you want to cancel the build process and remove the Build Configuration anyway?"));
|
|
|
|
|
box.exec();
|
|
|
|
|
if (box.clickedButton() != closeAnyway)
|
|
|
|
|
return;
|
2013-09-05 14:36:20 +02:00
|
|
|
BuildManager::cancel();
|
2011-10-24 13:10:38 +00:00
|
|
|
} else {
|
|
|
|
|
QMessageBox msgBox(QMessageBox::Question, tr("Remove Build Configuration?"),
|
|
|
|
|
tr("Do you really want to delete build configuration <b>%1</b>?").arg(deleteConfiguration->displayName()),
|
|
|
|
|
QMessageBox::Yes|QMessageBox::No, this);
|
|
|
|
|
msgBox.setDefaultButton(QMessageBox::No);
|
|
|
|
|
msgBox.setEscapeButton(QMessageBox::No);
|
|
|
|
|
if (msgBox.exec() == QMessageBox::No)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
m_target->removeBuildConfiguration(deleteConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|