2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 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
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
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
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
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 "buildsettingspropertiespage.h"
|
|
|
|
|
#include "buildstep.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"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-01-12 15:06:43 +01:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2009-10-29 15:17:21 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-11-30 16:44:22 +01:00
|
|
|
#include <QtCore/QMargins>
|
|
|
|
|
#include <QtCore/QTimer>
|
2010-02-24 16:34:22 +01:00
|
|
|
#include <QtCore/QCoreApplication>
|
2009-11-30 16:44:22 +01:00
|
|
|
#include <QtGui/QComboBox>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtGui/QInputDialog>
|
|
|
|
|
#include <QtGui/QLabel>
|
2009-09-29 11:39:55 +02:00
|
|
|
#include <QtGui/QMenu>
|
2009-11-30 16:44:22 +01:00
|
|
|
#include <QtGui/QPushButton>
|
|
|
|
|
#include <QtGui/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
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool BuildSettingsPanelFactory::supports(Target *target)
|
|
|
|
|
{
|
|
|
|
|
return target->buildConfigurationFactory();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
IPropertiesPanel *BuildSettingsPanelFactory::createPanel(Target *target)
|
|
|
|
|
{
|
|
|
|
|
return new BuildSettingsPanel(target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
///
|
2009-11-30 16:44:22 +01:00
|
|
|
// BuildSettingsPanel
|
2008-12-02 12:01:29 +01:00
|
|
|
///
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
BuildSettingsPanel::BuildSettingsPanel(Target *target) :
|
|
|
|
|
m_widget(new BuildSettingsWidget(target)),
|
2010-02-19 14:16:37 +01:00
|
|
|
m_icon(":/projectexplorer/images/BuildSettings.png")
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildSettingsPanel::~BuildSettingsPanel()
|
|
|
|
|
{
|
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 BuildSettingsPanel::displayName() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-24 16:34:22 +01:00
|
|
|
return QCoreApplication::translate("BuildSettingsPanel", "Build Settings");
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-11-25 15:57:09 +01:00
|
|
|
QWidget *BuildSettingsPanel::widget() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
return m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-25 15:57:09 +01:00
|
|
|
QIcon BuildSettingsPanel::icon() const
|
|
|
|
|
{
|
|
|
|
|
return m_icon;
|
|
|
|
|
}
|
|
|
|
|
|
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),
|
2009-11-30 16:44:22 +01:00
|
|
|
m_buildConfiguration(0),
|
|
|
|
|
m_leftMargin(0)
|
2009-07-16 15:33:19 +02:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
Q_ASSERT(m_target);
|
|
|
|
|
setupUi();
|
2009-07-16 15:33:19 +02:00
|
|
|
}
|
|
|
|
|
|
2009-12-07 15:17:37 +01:00
|
|
|
void BuildSettingsWidget::setupUi()
|
2009-07-16 15:33:19 +02:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
m_leftMargin = Constants::PANEL_LEFT_MARGIN;
|
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
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!m_target->buildConfigurationFactory()) {
|
|
|
|
|
QLabel * noSettingsLabel(new QLabel(this));
|
|
|
|
|
noSettingsLabel->setText(tr("No Build Settings available"));
|
|
|
|
|
{
|
|
|
|
|
QFont f(noSettingsLabel->font());
|
|
|
|
|
f.setPointSizeF(f.pointSizeF() * 1.2);
|
|
|
|
|
noSettingsLabel->setFont(f);
|
|
|
|
|
}
|
|
|
|
|
vbox->addWidget(noSettingsLabel);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-29 15:17:21 +01:00
|
|
|
{ // Edit Build Configuration row
|
|
|
|
|
QHBoxLayout *hbox = new QHBoxLayout();
|
2009-11-30 16:44:22 +01:00
|
|
|
hbox->setContentsMargins(m_leftMargin, 0, 0, 0);
|
2009-10-29 15:17:21 +01:00
|
|
|
hbox->addWidget(new QLabel(tr("Edit Build Configuration:"), this));
|
|
|
|
|
m_buildConfigurationComboBox = new QComboBox(this);
|
|
|
|
|
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
|
|
|
|
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
|
|
|
|
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();
|
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-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
|
|
|
|
|
|
|
|
connect(m_target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
|
2009-12-14 19:48:55 +01:00
|
|
|
this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
connect(m_target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
|
2009-12-14 19:48:55 +01:00
|
|
|
this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
foreach (BuildConfiguration *bc, m_target->buildConfigurations()) {
|
2009-12-14 19:48:55 +01:00
|
|
|
connect(bc, SIGNAL(displayNameChanged()),
|
|
|
|
|
this, SLOT(buildConfigurationDisplayNameChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
if (m_target->buildConfigurationFactory())
|
|
|
|
|
connect(m_target->buildConfigurationFactory(), SIGNAL(availableCreationIdsChanged()),
|
|
|
|
|
SLOT(updateAddButtonMenu()));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-14 19:48:55 +01:00
|
|
|
void BuildSettingsWidget::addedBuildConfiguration(BuildConfiguration *bc)
|
|
|
|
|
{
|
|
|
|
|
connect(bc, SIGNAL(displayNameChanged()),
|
|
|
|
|
this, SLOT(buildConfigurationDisplayNameChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildSettingsWidget::removedBuildConfiguration(BuildConfiguration *bc)
|
|
|
|
|
{
|
|
|
|
|
disconnect(bc, SIGNAL(displayNameChanged()),
|
|
|
|
|
this, SLOT(buildConfigurationDisplayNameChanged()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildSettingsWidget::buildConfigurationDisplayNameChanged()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
|
|
|
|
BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>();
|
2010-03-12 14:58:51 +01:00
|
|
|
m_buildConfigurationComboBox->setItemText(i, bc->displayName());
|
2009-12-14 19:48:55 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
void BuildSettingsWidget::addSubWidget(const QString &name, BuildConfigWidget *widget)
|
2009-11-30 16:44:22 +01:00
|
|
|
{
|
|
|
|
|
widget->setContentsMargins(m_leftMargin, 10, 0, 0);
|
|
|
|
|
|
|
|
|
|
QLabel *label = new QLabel(this);
|
|
|
|
|
label->setText(name);
|
|
|
|
|
QFont f = label->font();
|
|
|
|
|
f.setBold(true);
|
|
|
|
|
f.setPointSizeF(f.pointSizeF() * 1.2);
|
|
|
|
|
label->setFont(f);
|
|
|
|
|
|
|
|
|
|
label->setContentsMargins(m_leftMargin, 10, 0, 0);
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
QList<BuildConfigWidget *> 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-02-08 15:50:06 +01:00
|
|
|
if (m_target &&
|
|
|
|
|
m_target->activeBuildConfiguration()) {
|
|
|
|
|
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
|
|
|
|
this, SLOT(cloneConfiguration()));
|
|
|
|
|
}
|
|
|
|
|
IBuildConfigurationFactory *factory = m_target->buildConfigurationFactory();
|
2009-09-28 15:02:12 +02:00
|
|
|
if (factory) {
|
2010-02-08 15:50:06 +01:00
|
|
|
foreach (const QString &id, factory->availableCreationIds(m_target)) {
|
2010-01-07 18:17:24 +01:00
|
|
|
QAction *action = m_addButtonMenu->addAction(factory->displayNameForId(id), this, SLOT(createConfiguration()));
|
|
|
|
|
action->setData(id);
|
2009-09-28 15:02:12 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void BuildSettingsWidget::updateBuildSettings()
|
|
|
|
|
{
|
|
|
|
|
// Delete old tree items
|
2009-10-05 12:45:14 +02:00
|
|
|
bool blocked = m_buildConfigurationComboBox->blockSignals(true);
|
2009-07-16 15:33:19 +02:00
|
|
|
m_buildConfigurationComboBox->clear();
|
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
|
|
|
|
|
|
|
|
// Add pages
|
2010-02-08 15:50:06 +01:00
|
|
|
BuildConfigWidget *generalConfigWidget = m_target->project()->createConfigWidget();
|
2009-11-30 16:44:22 +01:00
|
|
|
addSubWidget(generalConfigWidget->displayName(), generalConfigWidget);
|
2009-07-16 15:33:19 +02:00
|
|
|
|
2010-03-16 14:36:59 +01:00
|
|
|
addSubWidget(tr("Build Steps"), new BuildStepsPage(m_target, Build));
|
|
|
|
|
addSubWidget(tr("Clean Steps"), new BuildStepsPage(m_target, Clean));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QList<BuildConfigWidget *> subConfigWidgets = m_target->project()->subConfigWidgets();
|
2009-08-06 15:31:32 +02:00
|
|
|
foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
|
2009-11-30 16:44:22 +01:00
|
|
|
addSubWidget(subConfigWidget->displayName(), subConfigWidget);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Add tree items
|
2010-02-08 15:50:06 +01:00
|
|
|
foreach (BuildConfiguration *bc, m_target->buildConfigurations()) {
|
2010-03-12 14:58:51 +01:00
|
|
|
m_buildConfigurationComboBox->addItem(bc->displayName(), QVariant::fromValue<BuildConfiguration *>(bc));
|
2009-11-24 15:36:31 +01:00
|
|
|
if (bc == m_buildConfiguration)
|
2009-07-16 15:33:19 +02:00
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
foreach (BuildConfigWidget *widget, subWidgets())
|
|
|
|
|
widget->init(m_buildConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-12 14:58:51 +01:00
|
|
|
m_buildConfigurationComboBox->blockSignals(blocked);
|
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-03-12 14:58:51 +01:00
|
|
|
BuildConfiguration *buildConfiguration = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
|
|
|
|
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();
|
|
|
|
|
|
2009-07-16 15:33:19 +02:00
|
|
|
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
2009-11-24 15:36:31 +01:00
|
|
|
if (m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>() == m_buildConfiguration) {
|
2009-07-16 15:33:19 +02:00
|
|
|
m_buildConfigurationComboBox->setCurrentIndex(i);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2009-11-30 16:44:22 +01:00
|
|
|
foreach (QWidget *widget, subWidgets()) {
|
2009-08-06 15:31:32 +02:00
|
|
|
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
2009-09-17 13:59:10 +02:00
|
|
|
buildStepWidget->init(m_buildConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
2009-10-29 15:17:21 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void BuildSettingsWidget::createConfiguration()
|
|
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!m_target->buildConfigurationFactory())
|
|
|
|
|
return;
|
|
|
|
|
|
2009-09-28 15:02:12 +02:00
|
|
|
QAction *action = qobject_cast<QAction *>(sender());
|
2010-02-08 15:50:06 +01:00
|
|
|
const QString &id = action->data().toString();
|
|
|
|
|
BuildConfiguration *bc = m_target->buildConfigurationFactory()->create(m_target, id);
|
2009-11-24 15:36:31 +01:00
|
|
|
if (bc) {
|
2010-04-15 14:12:37 +02:00
|
|
|
m_target->setActiveBuildConfiguration(bc);
|
2009-09-28 15:02:12 +02:00
|
|
|
updateBuildSettings();
|
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:36:31 +01:00
|
|
|
void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfiguration)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!sourceConfiguration ||
|
|
|
|
|
!m_target->buildConfigurationFactory())
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
|
2009-11-30 16:44:22 +01:00
|
|
|
QString newDisplayName(QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:")));
|
2009-11-24 15:36:31 +01:00
|
|
|
if (newDisplayName.isEmpty())
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
|
2009-10-08 20:01:07 +02:00
|
|
|
QStringList buildConfigurationDisplayNames;
|
2010-02-08 15:50:06 +01:00
|
|
|
foreach(BuildConfiguration *bc, m_target->buildConfigurations())
|
2009-10-08 20:01:07 +02:00
|
|
|
buildConfigurationDisplayNames << bc->displayName();
|
|
|
|
|
newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames);
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
BuildConfiguration * bc(m_target->buildConfigurationFactory()->clone(m_target, sourceConfiguration));
|
|
|
|
|
if (!bc)
|
2010-01-18 12:11:04 +01:00
|
|
|
return;
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2010-04-15 13:54:32 +02:00
|
|
|
bc->setDisplayName(newDisplayName);
|
|
|
|
|
m_target->addBuildConfiguration(bc);
|
2008-12-02 12:01:29 +01:00
|
|
|
updateBuildSettings();
|
2010-04-15 13:54:32 +02:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
m_target->removeBuildConfiguration(deleteConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
updateBuildSettings();
|
|
|
|
|
}
|