2013-01-30 18:19:31 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2013-01-30 18:19:31 +01:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** 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
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** 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.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "qbsbuildconfiguration.h"
|
|
|
|
|
|
|
|
|
|
#include "qbsbuildconfigurationwidget.h"
|
2013-07-22 15:53:57 +02:00
|
|
|
#include "qbsbuildinfo.h"
|
2013-01-30 18:19:31 +01:00
|
|
|
#include "qbsbuildstep.h"
|
|
|
|
|
#include "qbscleanstep.h"
|
|
|
|
|
#include "qbsproject.h"
|
|
|
|
|
#include "qbsprojectmanagerconstants.h"
|
|
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <coreplugin/documentmanager.h>
|
2013-07-22 15:53:57 +02:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <coreplugin/mimedatabase.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
#include <projectexplorer/buildsteplist.h>
|
|
|
|
|
#include <projectexplorer/kit.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2014-10-22 09:16:55 +02:00
|
|
|
#include <projectexplorer/projectmacroexpander.h>
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <projectexplorer/toolchain.h>
|
|
|
|
|
|
|
|
|
|
#include <QInputDialog>
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
using namespace ProjectExplorer;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
namespace QbsProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
const char QBS_BC_ID[] = "Qbs.QbsBuildConfiguration";
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsBuildConfiguration:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
QbsBuildConfiguration::QbsBuildConfiguration(Target *target) :
|
2013-01-30 18:19:31 +01:00
|
|
|
BuildConfiguration(target, Core::Id(QBS_BC_ID)),
|
|
|
|
|
m_isParsing(true),
|
|
|
|
|
m_parsingError(false)
|
|
|
|
|
{
|
2014-10-21 18:10:39 +02:00
|
|
|
connect(project(), &QbsProject::projectParsingStarted, this, &BuildConfiguration::enabledChanged);
|
|
|
|
|
connect(project(), &QbsProject::projectParsingDone, this, &BuildConfiguration::enabledChanged);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildStepList *bsl = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
|
|
|
|
connect(bsl, &BuildStepList::stepInserted, this, &QbsBuildConfiguration::buildStepInserted);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Core::Id id) :
|
2013-01-30 18:19:31 +01:00
|
|
|
BuildConfiguration(target, id)
|
|
|
|
|
{ }
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
QbsBuildConfiguration::QbsBuildConfiguration(Target *target, QbsBuildConfiguration *source) :
|
2013-08-16 17:45:16 +02:00
|
|
|
BuildConfiguration(target, source)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
cloneSteps(source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QbsBuildConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!BuildConfiguration::fromMap(map))
|
|
|
|
|
return false;
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildStepList *bsl = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
2013-01-30 18:19:31 +01:00
|
|
|
// Fix up the existing build steps:
|
|
|
|
|
for (int i = 0; i < bsl->count(); ++i) {
|
|
|
|
|
QbsBuildStep *bs = qobject_cast<QbsBuildStep *>(bsl->at(i));
|
|
|
|
|
if (bs)
|
2014-10-21 18:10:39 +02:00
|
|
|
connect(bs, &QbsBuildStep::qbsConfigurationChanged, this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QbsBuildConfiguration::buildStepInserted(int pos)
|
|
|
|
|
{
|
|
|
|
|
QbsBuildStep *step = qobject_cast<QbsBuildStep *>(stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->at(pos));
|
|
|
|
|
if (step) {
|
2014-10-21 18:10:39 +02:00
|
|
|
connect(step, &QbsBuildStep::qbsConfigurationChanged, this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
2013-01-30 18:19:31 +01:00
|
|
|
emit qbsConfigurationChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
NamedWidget *QbsBuildConfiguration::createConfigWidget()
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
return new QbsBuildConfigurationWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QbsBuildStep *QbsBuildConfiguration::qbsStep() const
|
|
|
|
|
{
|
2014-10-21 18:10:39 +02:00
|
|
|
foreach (BuildStep *bs, stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)->steps()) {
|
2013-01-30 18:19:31 +01:00
|
|
|
if (QbsBuildStep *qbsBs = qobject_cast<QbsBuildStep *>(bs))
|
|
|
|
|
return qbsBs;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap QbsBuildConfiguration::qbsConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
QVariantMap config;
|
|
|
|
|
QbsBuildStep *qbsBs = qbsStep();
|
|
|
|
|
if (qbsBs)
|
|
|
|
|
config = qbsBs->qbsConfiguration();
|
|
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Internal::QbsProject *QbsBuildConfiguration::project() const
|
|
|
|
|
{
|
|
|
|
|
return qobject_cast<Internal::QbsProject *>(target()->project());
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
IOutputParser *QbsBuildConfiguration::createOutputParser() const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2014-10-21 18:10:39 +02:00
|
|
|
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
|
2013-01-30 18:19:31 +01:00
|
|
|
return tc ? tc->outputParser() : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QbsBuildConfiguration::isEnabled() const
|
|
|
|
|
{
|
|
|
|
|
return !project()->isParsing() && project()->hasParseResult();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QbsBuildConfiguration::disabledReason() const
|
|
|
|
|
{
|
|
|
|
|
if (project()->isParsing())
|
|
|
|
|
return tr("Parsing the Qbs project.");
|
|
|
|
|
if (!project()->hasParseResult())
|
|
|
|
|
return tr("Parsing of Qbs project has failed.");
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildConfiguration::BuildType QbsBuildConfiguration::buildType() const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
QString variant;
|
|
|
|
|
if (qbsStep())
|
|
|
|
|
variant = qbsStep()->buildVariant();
|
|
|
|
|
|
|
|
|
|
if (variant == QLatin1String(Constants::QBS_VARIANT_DEBUG))
|
|
|
|
|
return Debug;
|
|
|
|
|
if (variant == QLatin1String(Constants::QBS_VARIANT_RELEASE))
|
|
|
|
|
return Release;
|
|
|
|
|
return Unknown;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QbsBuildConfiguration::setChangedFiles(const QStringList &files)
|
|
|
|
|
{
|
|
|
|
|
m_changedFiles = files;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QbsBuildConfiguration::changedFiles() const
|
|
|
|
|
{
|
|
|
|
|
return m_changedFiles;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-24 16:47:02 +02:00
|
|
|
void QbsBuildConfiguration::setActiveFileTags(const QStringList &fileTags)
|
|
|
|
|
{
|
|
|
|
|
m_activeFileTags = fileTags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QbsBuildConfiguration::activeFileTags() const
|
|
|
|
|
{
|
|
|
|
|
return m_activeFileTags;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-10 15:40:18 +02:00
|
|
|
void QbsBuildConfiguration::setProducts(const QStringList &products)
|
|
|
|
|
{
|
|
|
|
|
m_products = products;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList QbsBuildConfiguration::products() const
|
|
|
|
|
{
|
|
|
|
|
return m_products;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-19 15:29:11 +02:00
|
|
|
void QbsBuildConfiguration::emitBuildTypeChanged()
|
|
|
|
|
{
|
|
|
|
|
emit buildTypeChanged();
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
QbsBuildConfiguration *QbsBuildConfiguration::setup(Target *t,
|
2013-01-30 18:19:31 +01:00
|
|
|
const QString &defaultDisplayName,
|
|
|
|
|
const QString &displayName,
|
|
|
|
|
const QVariantMap &buildData,
|
|
|
|
|
const Utils::FileName &directory)
|
|
|
|
|
{
|
|
|
|
|
// Add the build configuration.
|
|
|
|
|
QbsBuildConfiguration *bc = new QbsBuildConfiguration(t);
|
|
|
|
|
bc->setDefaultDisplayName(defaultDisplayName);
|
|
|
|
|
bc->setDisplayName(displayName);
|
|
|
|
|
bc->setBuildDirectory(directory);
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
2013-01-30 18:19:31 +01:00
|
|
|
QbsBuildStep *bs = new QbsBuildStep(buildSteps);
|
|
|
|
|
bs->setQbsConfiguration(buildData);
|
|
|
|
|
buildSteps->insertStep(0, bs);
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildStepList *cleanSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
|
2013-01-30 18:19:31 +01:00
|
|
|
QbsCleanStep *cs = new QbsCleanStep(cleanSteps);
|
|
|
|
|
cleanSteps->insertStep(0, cs);
|
|
|
|
|
|
|
|
|
|
return bc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// QbsBuildConfigurationFactory:
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
QbsBuildConfigurationFactory::QbsBuildConfigurationFactory(QObject *parent) :
|
|
|
|
|
IBuildConfigurationFactory(parent)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
QbsBuildConfigurationFactory::~QbsBuildConfigurationFactory()
|
|
|
|
|
{ }
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
bool QbsBuildConfigurationFactory::canHandle(const Target *t) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
return qobject_cast<Internal::QbsProject *>(t->project());
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildInfo *QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
|
|
|
|
BuildConfiguration::BuildType type) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2013-07-22 15:53:57 +02:00
|
|
|
QbsBuildInfo *info = new QbsBuildInfo(this);
|
|
|
|
|
info->typeName = tr("Build");
|
|
|
|
|
info->kitId = k->id();
|
|
|
|
|
info->type = type;
|
2013-08-13 10:52:57 +02:00
|
|
|
info->supportsShadowBuild = true;
|
2013-07-22 15:53:57 +02:00
|
|
|
return info;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
int QbsBuildConfigurationFactory::priority(const Target *parent) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2013-07-24 12:42:24 +02:00
|
|
|
return canHandle(parent) ? 0 : -1;
|
2013-01-30 18:19:31 +01:00
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
QList<BuildInfo *> QbsBuildConfigurationFactory::availableBuilds(const Target *parent) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
2014-10-21 18:10:39 +02:00
|
|
|
QList<BuildInfo *> result;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildInfo *info = createBuildInfo(parent->kit(), BuildConfiguration::Debug);
|
2013-07-22 15:53:57 +02:00
|
|
|
result << info;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
int QbsBuildConfigurationFactory::priority(const Kit *k, const QString &projectPath) const
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
2013-10-01 17:39:17 +03:00
|
|
|
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
|
2013-07-24 12:42:24 +02:00
|
|
|
.matchesType(QLatin1String(Constants::MIME_TYPE))) ? 0 : -1;
|
2013-08-13 10:52:57 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-22 09:16:55 +02:00
|
|
|
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath, const Kit *k,
|
|
|
|
|
const QString &bcName)
|
|
|
|
|
{
|
|
|
|
|
const QString projectName = QFileInfo(projectFilePath).completeBaseName();
|
|
|
|
|
ProjectMacroExpander expander(projectName, k, bcName);
|
|
|
|
|
QString projectDir = Project::projectDirectory(Utils::FileName::fromString(projectFilePath)).toString();
|
|
|
|
|
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
|
|
|
|
return Utils::FileName::fromString(Utils::FileUtils::resolvePath(projectDir, buildPath));
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
QList<BuildInfo *> QbsBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
|
2013-08-13 10:52:57 +02:00
|
|
|
{
|
2014-10-21 18:10:39 +02:00
|
|
|
QList<BuildInfo *> result;
|
2013-08-13 10:52:57 +02:00
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildInfo *info = createBuildInfo(k, BuildConfiguration::Debug);
|
2013-08-13 10:52:57 +02:00
|
|
|
//: The name of the debug build configuration created by default for a qbs project.
|
|
|
|
|
info->displayName = tr("Debug");
|
2014-10-22 09:16:55 +02:00
|
|
|
info->buildDirectory = defaultBuildDirectory(projectPath, k, info->displayName);
|
2013-08-13 10:52:57 +02:00
|
|
|
result << info;
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
info = createBuildInfo(k, BuildConfiguration::Release);
|
2013-08-13 10:52:57 +02:00
|
|
|
//: The name of the release build configuration created by default for a qbs project.
|
|
|
|
|
info->displayName = tr("Release");
|
2014-10-22 09:16:55 +02:00
|
|
|
info->buildDirectory = defaultBuildDirectory(projectPath, k, info->displayName);
|
2013-08-13 10:52:57 +02:00
|
|
|
result << info;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildConfiguration *QbsBuildConfigurationFactory::create(Target *parent, const BuildInfo *info) const
|
2013-07-22 15:53:57 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(info->factory() == this, return 0);
|
|
|
|
|
QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
|
|
|
|
|
QTC_ASSERT(!info->displayName.isEmpty(), return 0);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
const QbsBuildInfo *qbsInfo = static_cast<const QbsBuildInfo *>(info);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
QVariantMap configData;
|
|
|
|
|
configData.insert(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY),
|
2014-10-21 18:10:39 +02:00
|
|
|
(qbsInfo->type == BuildConfiguration::Release)
|
2013-07-22 15:53:57 +02:00
|
|
|
? QLatin1String(Constants::QBS_VARIANT_RELEASE)
|
|
|
|
|
: QLatin1String(Constants::QBS_VARIANT_DEBUG));
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-05-02 11:36:15 +02:00
|
|
|
Utils::FileName buildDir = info->buildDirectory;
|
|
|
|
|
if (buildDir.isEmpty())
|
2014-10-22 09:16:55 +02:00
|
|
|
buildDir = defaultBuildDirectory(parent->project()->projectDirectory().toString(),
|
|
|
|
|
parent->kit(), info->displayName);
|
2014-05-02 11:36:15 +02:00
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildConfiguration *bc
|
2013-07-22 15:53:57 +02:00
|
|
|
= QbsBuildConfiguration::setup(parent, info->displayName, info->displayName,
|
2014-05-02 11:36:15 +02:00
|
|
|
configData, buildDir);
|
2013-07-22 15:53:57 +02:00
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
return bc;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
bool QbsBuildConfigurationFactory::canClone(const Target *parent, BuildConfiguration *source) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
return canHandle(parent) && qobject_cast<QbsBuildConfiguration *>(source);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildConfiguration *QbsBuildConfigurationFactory::clone(Target *parent, BuildConfiguration *source)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
if (!canClone(parent, source))
|
|
|
|
|
return 0;
|
|
|
|
|
QbsBuildConfiguration *oldbc(static_cast<QbsBuildConfiguration *>(source));
|
|
|
|
|
return new QbsBuildConfiguration(parent, oldbc);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
bool QbsBuildConfigurationFactory::canRestore(const Target *parent, const QVariantMap &map) const
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
if (!canHandle(parent))
|
|
|
|
|
return false;
|
|
|
|
|
return ProjectExplorer::idFromMap(map) == Core::Id(QBS_BC_ID);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-21 18:10:39 +02:00
|
|
|
BuildConfiguration *QbsBuildConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
2013-01-30 18:19:31 +01:00
|
|
|
{
|
|
|
|
|
if (!canRestore(parent, map))
|
|
|
|
|
return 0;
|
|
|
|
|
QbsBuildConfiguration *bc = new QbsBuildConfiguration(parent);
|
|
|
|
|
if (bc->fromMap(map))
|
|
|
|
|
return bc;
|
|
|
|
|
delete bc;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QbsProjectManager
|