2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company 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"
|
2013-07-22 15:53:57 +02:00
|
|
|
#include "buildinfo.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#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>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <coreplugin/icore.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-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
|
|
|
{
|
2013-08-13 10:52:57 +02:00
|
|
|
clearWidgets();
|
2013-07-22 15:53:57 +02:00
|
|
|
qDeleteAll(m_buildInfoList);
|
2009-07-16 15:33:19 +02:00
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
void BuildSettingsWidget::clearWidgets()
|
2009-11-30 16:44:22 +01:00
|
|
|
{
|
|
|
|
|
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();
|
2013-07-22 15:53:57 +02:00
|
|
|
qDeleteAll(m_buildInfoList);
|
|
|
|
|
m_buildInfoList.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()));
|
|
|
|
|
}
|
2013-07-22 15:53:57 +02:00
|
|
|
IBuildConfigurationFactory *factory = IBuildConfigurationFactory::find(m_target);
|
2012-06-24 20:30:02 +03:00
|
|
|
if (!factory)
|
|
|
|
|
return;
|
2013-07-22 15:53:57 +02:00
|
|
|
m_buildInfoList = factory->availableBuilds(m_target);
|
|
|
|
|
foreach (BuildInfo *info, m_buildInfoList) {
|
|
|
|
|
QAction *action = m_addButtonMenu->addAction(info->typeName, this, SLOT(createConfiguration()));
|
|
|
|
|
action->setData(QVariant::fromValue(static_cast<void *>(info)));
|
2009-09-28 15:02:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void BuildSettingsWidget::updateBuildSettings()
|
|
|
|
|
{
|
2013-08-13 10:52:57 +02:00
|
|
|
clearWidgets();
|
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());
|
2013-07-22 15:53:57 +02:00
|
|
|
BuildInfo *info = static_cast<BuildInfo *>(action->data().value<void*>());
|
2014-09-03 13:36:35 +02:00
|
|
|
QString originalDisplayName = info->displayName;
|
2013-07-22 15:53:57 +02:00
|
|
|
|
|
|
|
|
if (info->displayName.isEmpty()) {
|
|
|
|
|
bool ok = false;
|
|
|
|
|
info->displayName = QInputDialog::getText(Core::ICore::mainWindow(),
|
|
|
|
|
tr("New Configuration"),
|
|
|
|
|
tr("New configuration name:"),
|
|
|
|
|
QLineEdit::Normal,
|
|
|
|
|
QString(), &ok).trimmed();
|
|
|
|
|
if (!ok || info->displayName.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
BuildConfiguration *bc = info->factory()->create(m_target, info);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!bc)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_target->addBuildConfiguration(bc);
|
|
|
|
|
m_target->setActiveBuildConfiguration(bc);
|
2014-09-03 13:36:35 +02:00
|
|
|
info->displayName = originalDisplayName;
|
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
|
|
|
}
|