2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-04 13:06:02 +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-04 13:06:02 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-04 13:06:02 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-04 13:06:02 +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-04 13:06:02 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-04 13:06:02 +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-04 13:06:02 +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-04 13:06:02 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
#include "makestep.h"
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
#include "cmakeprojectconstants.h"
|
|
|
|
|
#include "cmakeproject.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "cmaketarget.h"
|
2009-11-25 18:50:20 +01:00
|
|
|
#include "cmakebuildconfiguration.h"
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2009-09-29 11:39:55 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
2009-12-09 13:54:46 +01:00
|
|
|
#include <projectexplorer/gnumakeparser.h>
|
2009-09-29 11:39:55 +02:00
|
|
|
|
2009-01-12 15:10:33 +01:00
|
|
|
#include <QtGui/QFormLayout>
|
|
|
|
|
#include <QtGui/QGroupBox>
|
|
|
|
|
#include <QtGui/QCheckBox>
|
|
|
|
|
#include <QtGui/QLineEdit>
|
|
|
|
|
#include <QtGui/QListWidget>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
using namespace CMakeProjectManager;
|
|
|
|
|
using namespace CMakeProjectManager::Internal;
|
2009-10-27 14:16:28 +01:00
|
|
|
using namespace ProjectExplorer;
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
namespace {
|
|
|
|
|
const char * const MS_ID("CMakeProjectManager.MakeStep");
|
|
|
|
|
|
|
|
|
|
const char * const CLEAN_KEY("CMakeProjectManager.MakeStep.Clean");
|
|
|
|
|
const char * const BUILD_TARGETS_KEY("CMakeProjectManager.MakeStep.BuildTargets");
|
|
|
|
|
const char * const ADDITIONAL_ARGUMENTS_KEY("CMakeProjectManager.MakeStep.AdditionalArguments");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Move progress information into an IOutputParser!
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep::MakeStep(BuildStepList *bsl) :
|
|
|
|
|
AbstractProcessStep(bsl, QLatin1String(MS_ID)), m_clean(false),
|
2010-01-14 17:41:29 +01:00
|
|
|
m_futureInterface(0)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep::MakeStep(BuildStepList *bsl, const QString &id) :
|
|
|
|
|
AbstractProcessStep(bsl, id), m_clean(false),
|
2010-01-14 17:41:29 +01:00
|
|
|
m_futureInterface(0)
|
|
|
|
|
{
|
|
|
|
|
ctor();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
MakeStep::MakeStep(BuildStepList *bsl, MakeStep *bs) :
|
|
|
|
|
AbstractProcessStep(bsl, bs),
|
2009-10-27 14:16:28 +01:00
|
|
|
m_clean(bs->m_clean),
|
|
|
|
|
m_futureInterface(0),
|
|
|
|
|
m_buildTargets(bs->m_buildTargets),
|
|
|
|
|
m_additionalArguments(bs->m_buildTargets)
|
|
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
ctor();
|
|
|
|
|
}
|
2009-10-27 14:16:28 +01:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
void MakeStep::ctor()
|
|
|
|
|
{
|
|
|
|
|
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
2010-08-19 12:26:21 +02:00
|
|
|
//: Default display name for the cmake make step.
|
|
|
|
|
setDefaultDisplayName(tr("Make"));
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
MakeStep::~MakeStep()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *MakeStep::cmakeBuildConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-15 19:06:51 +02:00
|
|
|
void MakeStep::setClean(bool clean)
|
|
|
|
|
{
|
|
|
|
|
m_clean = clean;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap MakeStep::toMap() const
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
QVariantMap map(AbstractProcessStep::toMap());
|
|
|
|
|
map.insert(QLatin1String(CLEAN_KEY), m_clean);
|
|
|
|
|
map.insert(QLatin1String(BUILD_TARGETS_KEY), m_buildTargets);
|
|
|
|
|
map.insert(QLatin1String(ADDITIONAL_ARGUMENTS_KEY), m_additionalArguments);
|
|
|
|
|
return map;
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
bool MakeStep::fromMap(const QVariantMap &map)
|
2009-10-15 19:06:51 +02:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
m_clean = map.value(QLatin1String(CLEAN_KEY)).toBool();
|
|
|
|
|
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
|
|
|
|
|
m_additionalArguments = map.value(QLatin1String(ADDITIONAL_ARGUMENTS_KEY)).toStringList();
|
2009-10-15 19:06:51 +02:00
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
return BuildStep::fromMap(map);
|
2009-10-15 19:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
bool MakeStep::init()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
2009-02-16 13:12:12 +01:00
|
|
|
|
2009-10-15 19:06:51 +02:00
|
|
|
setEnabled(true);
|
2009-11-25 18:50:20 +01:00
|
|
|
setWorkingDirectory(bc->buildDirectory());
|
2009-07-02 16:44:51 +02:00
|
|
|
|
2009-11-25 18:50:20 +01:00
|
|
|
setCommand(bc->toolChain()->makeCommand());
|
2009-06-22 16:11:45 +02:00
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
QStringList arguments = m_buildTargets;
|
|
|
|
|
arguments << additionalArguments();
|
|
|
|
|
setArguments(arguments);
|
2009-11-25 18:50:20 +01:00
|
|
|
setEnvironment(bc->environment());
|
2009-10-15 19:06:51 +02:00
|
|
|
setIgnoreReturnValue(m_clean);
|
2009-06-22 16:11:45 +02:00
|
|
|
|
2009-12-09 13:54:46 +01:00
|
|
|
setOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory()));
|
|
|
|
|
if (bc->toolChain())
|
|
|
|
|
appendOutputParser(bc->toolChain()->outputParser());
|
|
|
|
|
|
|
|
|
|
return AbstractProcessStep::init();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
2009-04-07 13:52:28 +02:00
|
|
|
m_futureInterface = &fi;
|
|
|
|
|
m_futureInterface->setProgressRange(0, 100);
|
2009-12-09 13:54:46 +01:00
|
|
|
AbstractProcessStep::run(fi);
|
2009-05-25 17:09:38 +02:00
|
|
|
m_futureInterface->setProgressValue(100);
|
|
|
|
|
m_futureInterface->reportFinished();
|
2009-04-07 13:52:28 +02:00
|
|
|
m_futureInterface = 0;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-03-18 13:33:00 +01:00
|
|
|
return new MakeStepConfigWidget(this);
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MakeStep::immutable() const
|
|
|
|
|
{
|
2010-04-22 17:25:28 +02:00
|
|
|
return false;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-04-01 15:14:38 +02:00
|
|
|
void MakeStep::stdOutput(const QString &line)
|
2009-02-16 13:12:12 +01:00
|
|
|
{
|
2009-04-07 13:52:28 +02:00
|
|
|
if (m_percentProgress.indexIn(line) != -1) {
|
|
|
|
|
bool ok = false;
|
|
|
|
|
int percent = m_percentProgress.cap(1).toInt(&ok);;
|
|
|
|
|
if (ok)
|
|
|
|
|
m_futureInterface->setProgressValue(percent);
|
|
|
|
|
}
|
2009-12-09 13:54:46 +01:00
|
|
|
AbstractProcessStep::stdOutput(line);
|
2009-02-16 13:12:12 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
bool MakeStep::buildsBuildTarget(const QString &target) const
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
return m_buildTargets.contains(target);
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void MakeStep::setBuildTarget(const QString &buildTarget, bool on)
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
QStringList old = m_buildTargets;
|
2010-02-02 12:01:11 +01:00
|
|
|
if (on && !old.contains(buildTarget))
|
|
|
|
|
old << buildTarget;
|
|
|
|
|
else if(!on && old.contains(buildTarget))
|
|
|
|
|
old.removeOne(buildTarget);
|
2009-10-27 14:16:28 +01:00
|
|
|
m_buildTargets = old;
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
QStringList MakeStep::additionalArguments() const
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
return m_additionalArguments;
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
void MakeStep::setAdditionalArguments(const QStringList &list)
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
m_additionalArguments = list;
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-18 13:33:00 +01:00
|
|
|
// MakeStepConfigWidget
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
2009-01-12 15:10:33 +01:00
|
|
|
: m_makeStep(makeStep)
|
|
|
|
|
{
|
|
|
|
|
QFormLayout *fl = new QFormLayout(this);
|
2009-07-23 17:00:38 +02:00
|
|
|
fl->setMargin(0);
|
|
|
|
|
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
2009-01-12 15:10:33 +01:00
|
|
|
setLayout(fl);
|
|
|
|
|
|
2009-03-12 15:51:44 +01:00
|
|
|
m_additionalArguments = new QLineEdit(this);
|
2009-04-17 21:11:52 +02:00
|
|
|
fl->addRow(tr("Additional arguments:"), m_additionalArguments);
|
2009-03-12 15:51:44 +01:00
|
|
|
|
|
|
|
|
connect(m_additionalArguments, SIGNAL(textEdited(const QString &)), this, SLOT(additionalArgumentsEdited()));
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
m_buildTargetsList = new QListWidget;
|
|
|
|
|
m_buildTargetsList->setMinimumHeight(200);
|
|
|
|
|
fl->addRow(tr("Targets:"), m_buildTargetsList);
|
2009-01-12 15:10:33 +01:00
|
|
|
|
|
|
|
|
// TODO update this list also on rescans of the CMakeLists.txt
|
2009-11-24 15:36:31 +01:00
|
|
|
// TODO shouldn't be accessing project
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject();
|
2010-02-02 12:01:11 +01:00
|
|
|
foreach(const QString& buildTarget, pro->buildTargetTitles()) {
|
|
|
|
|
QListWidgetItem *item = new QListWidgetItem(buildTarget, m_buildTargetsList);
|
2009-01-12 15:10:33 +01:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
|
|
|
|
item->setCheckState(Qt::Unchecked);
|
|
|
|
|
}
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
2009-08-12 17:02:28 +02:00
|
|
|
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
|
|
|
|
this, SLOT(updateDetails()));
|
2009-12-03 19:45:09 +01:00
|
|
|
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
void MakeStepConfigWidget::additionalArgumentsEdited()
|
2009-03-12 15:51:44 +01:00
|
|
|
{
|
2010-09-23 10:35:23 +02:00
|
|
|
m_makeStep->setAdditionalArguments(Utils::Environment::parseCombinedArgString(m_additionalArguments->text()));
|
2009-08-06 17:26:38 +02:00
|
|
|
updateDetails();
|
2009-03-12 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
void MakeStepConfigWidget::itemChanged(QListWidgetItem *item)
|
2009-01-12 15:10:33 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
m_makeStep->setBuildTarget(item->text(), item->checkState() & Qt::Checked);
|
2009-08-06 17:26:38 +02:00
|
|
|
updateDetails();
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
2008-12-04 13:06:02 +01:00
|
|
|
|
2009-03-18 13:33:00 +01:00
|
|
|
QString MakeStepConfigWidget::displayName() const
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
return tr("Make", "CMakeProjectManager::MakeStepConfigWidget display name.");
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 14:16:28 +01:00
|
|
|
void MakeStepConfigWidget::init()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-01-12 15:10:33 +01:00
|
|
|
// disconnect to make the changes to the items
|
2010-02-02 12:01:11 +01:00
|
|
|
disconnect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
|
|
|
|
int count = m_buildTargetsList->count();
|
2009-01-12 15:10:33 +01:00
|
|
|
for(int i = 0; i < count; ++i) {
|
2010-02-02 12:01:11 +01:00
|
|
|
QListWidgetItem *item = m_buildTargetsList->item(i);
|
|
|
|
|
item->setCheckState(m_makeStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
2009-01-12 15:10:33 +01:00
|
|
|
}
|
|
|
|
|
// and connect again
|
2010-02-02 12:01:11 +01:00
|
|
|
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
2009-03-12 15:51:44 +01:00
|
|
|
|
2010-09-23 10:35:23 +02:00
|
|
|
m_additionalArguments->setText(Utils::Environment::joinArgumentList(m_makeStep->additionalArguments()));
|
2009-08-06 17:26:38 +02:00
|
|
|
updateDetails();
|
2009-12-03 19:45:09 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject();
|
2010-02-02 12:01:11 +01:00
|
|
|
connect(pro, SIGNAL(buildTargetsChanged()),
|
|
|
|
|
this, SLOT(buildTargetsChanged()));
|
2009-12-03 19:45:09 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-02 12:01:11 +01:00
|
|
|
void MakeStepConfigWidget::buildTargetsChanged()
|
2009-12-03 19:45:09 +01:00
|
|
|
{
|
2010-02-02 12:01:11 +01:00
|
|
|
disconnect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
|
|
|
|
m_buildTargetsList->clear();
|
2010-02-08 15:50:06 +01:00
|
|
|
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeTarget()->cmakeProject();
|
2010-02-02 12:01:11 +01:00
|
|
|
foreach(const QString& buildTarget, pro->buildTargetTitles()) {
|
|
|
|
|
QListWidgetItem *item = new QListWidgetItem(buildTarget, m_buildTargetsList);
|
2009-12-03 19:45:09 +01:00
|
|
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
2010-02-02 12:01:11 +01:00
|
|
|
item->setCheckState(m_makeStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
|
2009-12-03 19:45:09 +01:00
|
|
|
}
|
2010-02-02 12:01:11 +01:00
|
|
|
connect(m_buildTargetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
|
2009-12-03 19:45:09 +01:00
|
|
|
updateSummary();
|
2009-08-06 17:26:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MakeStepConfigWidget::updateDetails()
|
|
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
QStringList arguments = m_makeStep->m_buildTargets;
|
|
|
|
|
arguments << m_makeStep->additionalArguments();
|
2009-11-24 15:36:31 +01:00
|
|
|
|
2009-11-26 14:43:27 +01:00
|
|
|
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
2009-11-30 15:21:42 +01:00
|
|
|
ProjectExplorer::ToolChain *tc = bc->toolChain();
|
|
|
|
|
if (tc)
|
2010-02-01 12:43:56 +01:00
|
|
|
m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(QString(QLatin1Char(' '))));
|
2009-11-30 15:21:42 +01:00
|
|
|
else
|
|
|
|
|
m_summaryText = tr("<b>Unknown Toolchain</b>");
|
2009-08-06 17:26:38 +02:00
|
|
|
emit updateSummary();
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
QString MakeStepConfigWidget::summaryText() const
|
|
|
|
|
{
|
2009-08-06 17:26:38 +02:00
|
|
|
return m_summaryText;
|
2009-08-06 15:31:32 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
2009-03-18 13:33:00 +01:00
|
|
|
// MakeStepFactory
|
2008-12-04 13:06:02 +01:00
|
|
|
//
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
MakeStepFactory::MakeStepFactory(QObject *parent) :
|
|
|
|
|
ProjectExplorer::IBuildStepFactory(parent)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-14 17:41:29 +01:00
|
|
|
MakeStepFactory::~MakeStepFactory()
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2009-10-27 14:16:28 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool MakeStepFactory::canCreate(BuildStepList *parent, const QString &id) const
|
2009-10-27 14:16:28 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (parent->target()->project()->id() != QLatin1String(Constants::CMAKEPROJECT_ID))
|
2010-01-14 17:41:29 +01:00
|
|
|
return false;
|
|
|
|
|
return QLatin1String(MS_ID) == id;
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep *MakeStepFactory::create(BuildStepList *parent, const QString &id)
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canCreate(parent, id))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
|
|
|
|
return new MakeStep(parent);
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool MakeStepFactory::canClone(BuildStepList *parent, BuildStep *source) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return canCreate(parent, source->id());
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep *MakeStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canClone(parent, source))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
|
|
|
|
return new MakeStep(parent, static_cast<MakeStep *>(source));
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
bool MakeStepFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
|
2008-12-04 13:06:02 +01:00
|
|
|
{
|
2010-01-14 17:41:29 +01:00
|
|
|
QString id(ProjectExplorer::idFromMap(map));
|
2010-07-16 14:00:41 +02:00
|
|
|
return canCreate(parent, id);
|
2008-12-04 13:06:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
BuildStep *MakeStepFactory::restore(BuildStepList *parent, const QVariantMap &map)
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (!canRestore(parent, map))
|
2010-01-14 17:41:29 +01:00
|
|
|
return 0;
|
|
|
|
|
MakeStep *bs(new MakeStep(parent));
|
|
|
|
|
if (bs->fromMap(map))
|
|
|
|
|
return bs;
|
|
|
|
|
delete bs;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 14:00:41 +02:00
|
|
|
QStringList MakeStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
2010-01-14 17:41:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
if (parent->target()->project()->id() == QLatin1String(Constants::CMAKEPROJECT_ID))
|
|
|
|
|
return QStringList() << QLatin1String(MS_ID);
|
|
|
|
|
return QStringList();
|
2010-01-14 17:41:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString MakeStepFactory::displayNameForId(const QString &id) const
|
|
|
|
|
{
|
|
|
|
|
if (id == QLatin1String(MS_ID))
|
|
|
|
|
return tr("Make", "Display name for CMakeProjectManager::MakeStep id.");
|
|
|
|
|
return QString();
|
|
|
|
|
}
|