2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-03-20 14:57:12 +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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-03-20 14:57:12 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-03-20 14:57:12 +01:00
|
|
|
|
2009-02-10 15:34:25 +01:00
|
|
|
#include "toolchain.h"
|
2011-03-24 13:27:26 +01:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
#include "abi.h"
|
2013-03-25 17:13:18 +01:00
|
|
|
#include "headerpath.h"
|
2016-12-16 00:43:14 +01:00
|
|
|
#include "projectexplorerconstants.h"
|
2011-03-24 13:27:26 +01:00
|
|
|
#include "toolchainmanager.h"
|
2013-03-21 12:27:18 +01:00
|
|
|
#include "task.h"
|
2011-03-24 13:27:26 +01:00
|
|
|
|
2013-03-25 17:13:18 +01:00
|
|
|
#include <utils/fileutils.h>
|
2015-07-09 11:34:37 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2009-03-16 18:13:45 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QUuid>
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-05-10 15:19:38 +02:00
|
|
|
static const char ID_KEY[] = "ProjectExplorer.ToolChain.Id";
|
|
|
|
|
static const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ToolChain.DisplayName";
|
2011-12-19 12:06:44 +01:00
|
|
|
static const char AUTODETECT_KEY[] = "ProjectExplorer.ToolChain.Autodetect";
|
2016-12-16 00:43:14 +01:00
|
|
|
static const char LANGUAGE_KEY_V1[] = "ProjectExplorer.ToolChain.Language"; // For QtCreator <= 4.2
|
|
|
|
|
static const char LANGUAGE_KEY_V2[] = "ProjectExplorer.ToolChain.LanguageV2"; // For QtCreator > 4.2
|
2012-02-07 18:05:09 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
namespace Internal {
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// ToolChainPrivate
|
|
|
|
|
// --------------------------------------------------------------------------
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
class ToolChainPrivate
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
public:
|
2013-09-03 10:58:59 +02:00
|
|
|
typedef ToolChain::Detection Detection;
|
|
|
|
|
|
2015-07-09 11:34:37 +02:00
|
|
|
explicit ToolChainPrivate(Core::Id typeId, Detection d) :
|
|
|
|
|
m_id(QUuid::createUuid().toByteArray()),
|
|
|
|
|
m_typeId(typeId),
|
2013-09-03 10:58:59 +02:00
|
|
|
m_detection(d)
|
2015-07-07 15:37:50 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_typeId.isValid(), return);
|
|
|
|
|
QTC_ASSERT(!m_typeId.toString().contains(QLatin1Char(':')), return);
|
|
|
|
|
}
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray m_id;
|
2016-12-16 00:43:14 +01:00
|
|
|
QSet<Core::Id> m_supportedLanguages;
|
2016-04-13 15:52:14 +02:00
|
|
|
mutable QString m_displayName;
|
2015-07-09 11:34:37 +02:00
|
|
|
Core::Id m_typeId;
|
2016-12-16 00:43:14 +01:00
|
|
|
Core::Id m_language;
|
2013-09-03 10:58:59 +02:00
|
|
|
Detection m_detection;
|
2011-02-01 18:36:00 +01:00
|
|
|
};
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
|
|
|
|
|
// Deprecated used from QtCreator <= 4.2
|
|
|
|
|
|
|
|
|
|
Core::Id fromLanguageV1(int language)
|
|
|
|
|
{
|
|
|
|
|
switch (language)
|
|
|
|
|
{
|
|
|
|
|
case Deprecated::Toolchain::C :
|
|
|
|
|
return Core::Id(Constants::C_LANGUAGE_ID);
|
|
|
|
|
case Deprecated::Toolchain::Cxx:
|
|
|
|
|
return Core::Id(Constants::CXX_LANGUAGE_ID);
|
|
|
|
|
case Deprecated::Toolchain::None:
|
|
|
|
|
default:
|
|
|
|
|
return Core::Id();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
} // namespace Internal
|
2009-03-16 18:13:45 +01:00
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
namespace Deprecated {
|
|
|
|
|
namespace Toolchain {
|
|
|
|
|
QString languageId(Language l)
|
|
|
|
|
{
|
|
|
|
|
switch (l) {
|
|
|
|
|
case Language::None:
|
|
|
|
|
return QStringLiteral("None");
|
|
|
|
|
case Language::C:
|
|
|
|
|
return QStringLiteral("C");
|
|
|
|
|
case Language::Cxx:
|
|
|
|
|
return QStringLiteral("Cxx");
|
|
|
|
|
};
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
} // namespace Toolchain
|
|
|
|
|
} // namespace Deprecated
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::ToolChain
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The ToolChain class represents a tool chain.
|
2011-04-14 12:58:14 +02:00
|
|
|
\sa ProjectExplorer::ToolChainManager
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// --------------------------------------------------------------------------
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2015-07-09 11:34:37 +02:00
|
|
|
ToolChain::ToolChain(Core::Id typeId, Detection d) :
|
|
|
|
|
d(new Internal::ToolChainPrivate(typeId, d))
|
2016-07-12 10:22:09 +02:00
|
|
|
{
|
|
|
|
|
}
|
2010-04-09 18:43:05 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
ToolChain::ToolChain(const ToolChain &other) :
|
2015-07-09 11:34:37 +02:00
|
|
|
d(new Internal::ToolChainPrivate(other.d->m_typeId, ManualDetection))
|
2010-04-09 18:43:05 +02:00
|
|
|
{
|
2016-07-12 10:22:09 +02:00
|
|
|
d->m_language = other.d->m_language;
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
// leave the autodetection bit at false.
|
2011-09-07 14:26:11 +02:00
|
|
|
d->m_displayName = QCoreApplication::translate("ProjectExplorer::ToolChain", "Clone of %1")
|
2011-03-03 16:46:51 +01:00
|
|
|
.arg(other.displayName());
|
2010-04-09 18:43:05 +02:00
|
|
|
}
|
|
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
void ToolChain::setLanguage(Core::Id language)
|
2016-07-12 10:22:09 +02:00
|
|
|
{
|
2016-12-16 00:43:14 +01:00
|
|
|
QTC_ASSERT(!d->m_language.isValid(), return);
|
|
|
|
|
QTC_ASSERT(language.isValid(), return);
|
|
|
|
|
QTC_ASSERT(ToolChainManager::isLanguageSupported(language), return);
|
2016-07-12 10:22:09 +02:00
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
d->m_language = language;
|
2016-07-12 10:22:09 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
ToolChain::~ToolChain()
|
2010-04-09 18:43:05 +02:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
delete d;
|
2010-04-09 18:43:05 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QString ToolChain::displayName() const
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
if (d->m_displayName.isEmpty())
|
2012-01-30 11:55:21 +01:00
|
|
|
return typeDisplayName();
|
2011-09-07 14:26:11 +02:00
|
|
|
return d->m_displayName;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-24 13:27:26 +01:00
|
|
|
void ToolChain::setDisplayName(const QString &name)
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
if (d->m_displayName == name)
|
2011-03-24 13:27:26 +01:00
|
|
|
return;
|
|
|
|
|
|
2011-09-07 14:26:11 +02:00
|
|
|
d->m_displayName = name;
|
2011-03-24 13:27:26 +01:00
|
|
|
toolChainUpdated();
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
ToolChain::Detection ToolChain::detection() const
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2013-09-03 10:58:59 +02:00
|
|
|
return d->m_detection;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray ToolChain::id() const
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
return d->m_id;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-03 14:01:25 +01:00
|
|
|
Utils::FileNameList ToolChain::suggestedMkspecList() const
|
2013-03-25 17:13:18 +01:00
|
|
|
{
|
2015-11-03 14:01:25 +01:00
|
|
|
return Utils::FileNameList();
|
2013-03-25 17:13:18 +01:00
|
|
|
}
|
|
|
|
|
|
2012-09-05 09:21:15 +02:00
|
|
|
Utils::FileName ToolChain::suggestedDebugger() const
|
2012-02-07 17:22:05 +01:00
|
|
|
{
|
2013-08-29 13:14:19 +02:00
|
|
|
return ToolChainManager::defaultDebugger(targetAbi());
|
2012-02-07 17:22:05 +01:00
|
|
|
}
|
|
|
|
|
|
2015-07-09 11:34:37 +02:00
|
|
|
Core::Id ToolChain::typeId() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_typeId;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-20 15:59:56 +02:00
|
|
|
QList<Abi> ToolChain::supportedAbis() const
|
|
|
|
|
{
|
2017-02-22 15:09:35 +01:00
|
|
|
return {targetAbi()};
|
2016-09-20 15:59:56 +02:00
|
|
|
}
|
|
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
Core::Id ToolChain::language() const
|
2016-07-12 10:22:09 +02:00
|
|
|
{
|
|
|
|
|
return d->m_language;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChain::canClone() const
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
return true;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChain::operator == (const ToolChain &tc) const
|
2010-04-21 17:24:37 +02:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
if (this == &tc)
|
|
|
|
|
return true;
|
2010-09-08 15:22:58 +02:00
|
|
|
|
2011-12-19 12:06:44 +01:00
|
|
|
// We ignore displayname
|
2016-10-30 12:01:38 +02:00
|
|
|
return typeId() == tc.typeId()
|
|
|
|
|
&& isAutoDetected() == tc.isAutoDetected()
|
|
|
|
|
&& language() == tc.language();
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain manager to save user-generated tool chains.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-10-07 13:34:40 +02:00
|
|
|
Make sure to call this function when deriving.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
QVariantMap ToolChain::toMap() const
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
QVariantMap result;
|
2015-07-09 11:34:37 +02:00
|
|
|
QString idToSave = d->m_typeId.toString() + QLatin1Char(':') + QString::fromUtf8(id());
|
|
|
|
|
result.insert(QLatin1String(ID_KEY), idToSave);
|
2011-02-01 18:36:00 +01:00
|
|
|
result.insert(QLatin1String(DISPLAY_NAME_KEY), displayName());
|
2011-12-19 12:06:44 +01:00
|
|
|
result.insert(QLatin1String(AUTODETECT_KEY), isAutoDetected());
|
2016-12-16 00:43:14 +01:00
|
|
|
result.insert(QLatin1String(LANGUAGE_KEY_V2), language().toSetting());
|
2011-02-01 18:36:00 +01:00
|
|
|
return result;
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2011-03-24 13:27:26 +01:00
|
|
|
void ToolChain::toolChainUpdated()
|
|
|
|
|
{
|
2013-08-29 13:14:19 +02:00
|
|
|
ToolChainManager::notifyAboutUpdate(this);
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
|
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
void ToolChain::setDetection(ToolChain::Detection de)
|
2011-03-01 16:34:02 +01:00
|
|
|
{
|
2013-09-03 10:58:59 +02:00
|
|
|
if (d->m_detection == de)
|
2011-03-24 13:27:26 +01:00
|
|
|
return;
|
2013-09-03 10:58:59 +02:00
|
|
|
d->m_detection = de;
|
2011-03-24 13:27:26 +01:00
|
|
|
toolChainUpdated();
|
2011-03-01 16:34:02 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain manager to load user-generated tool chains.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-10-07 13:34:40 +02:00
|
|
|
Make sure to call this function when deriving.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChain::fromMap(const QVariantMap &data)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-09-07 14:26:11 +02:00
|
|
|
d->m_displayName = data.value(QLatin1String(DISPLAY_NAME_KEY)).toString();
|
2015-07-09 11:34:37 +02:00
|
|
|
|
2011-12-19 12:06:44 +01:00
|
|
|
// make sure we have new style ids:
|
2015-07-09 11:34:37 +02:00
|
|
|
const QString id = data.value(QLatin1String(ID_KEY)).toString();
|
|
|
|
|
int pos = id.indexOf(QLatin1Char(':'));
|
|
|
|
|
QTC_ASSERT(pos > 0, return false);
|
|
|
|
|
d->m_typeId = Core::Id::fromString(id.left(pos));
|
2015-07-14 11:12:14 +02:00
|
|
|
d->m_id = id.mid(pos + 1).toUtf8();
|
2015-07-09 11:34:37 +02:00
|
|
|
|
2013-09-03 10:58:59 +02:00
|
|
|
const bool autoDetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
|
|
|
|
|
d->m_detection = autoDetect ? AutoDetectionFromSettings : ManualDetection;
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2017-01-23 16:30:06 +01:00
|
|
|
if (data.contains(LANGUAGE_KEY_V2)) {
|
|
|
|
|
// remove hack to trim language id in 4.4: This is to fix up broken language
|
|
|
|
|
// ids that happened in 4.3 master branch
|
|
|
|
|
const QString langId = data.value(QLatin1String(LANGUAGE_KEY_V2)).toString();
|
|
|
|
|
const int pos = langId.lastIndexOf('.');
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
d->m_language = Core::Id::fromString(langId.mid(pos + 1));
|
|
|
|
|
else
|
|
|
|
|
d->m_language = Core::Id::fromString(langId);
|
|
|
|
|
} else if (data.contains(LANGUAGE_KEY_V1)) { // Import from old settings
|
2016-12-16 00:43:14 +01:00
|
|
|
d->m_language = Internal::fromLanguageV1(data.value(QLatin1String(LANGUAGE_KEY_V1)).toInt());
|
2017-01-23 16:30:06 +01:00
|
|
|
}
|
2016-12-16 00:43:14 +01:00
|
|
|
|
|
|
|
|
if (!d->m_language.isValid())
|
|
|
|
|
d->m_language = Core::Id(Constants::CXX_LANGUAGE_ID);
|
2016-07-12 10:22:09 +02:00
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
return true;
|
2009-12-09 13:54:46 +01:00
|
|
|
}
|
|
|
|
|
|
2013-03-21 12:27:18 +01:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain kit information to validate the kit.
|
2013-03-21 12:27:18 +01:00
|
|
|
*/
|
|
|
|
|
|
2013-03-25 14:55:32 +02:00
|
|
|
QList<Task> ToolChain::validateKit(const Kit *) const
|
2013-03-21 12:27:18 +01:00
|
|
|
{
|
|
|
|
|
return QList<Task>();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::ToolChainFactory
|
2013-09-10 17:16:10 +02:00
|
|
|
\brief The ToolChainFactory class creates tool chains from settings or
|
|
|
|
|
autodetects them.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn QString ProjectExplorer::ToolChainFactory::displayName() const = 0
|
2013-09-10 17:16:10 +02:00
|
|
|
Contains the name used to display the name of the tool chain that will be
|
|
|
|
|
created.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2013-03-03 21:53:38 +04:00
|
|
|
/*!
|
|
|
|
|
\fn QStringList ProjectExplorer::ToolChain::clangParserFlags(const QStringList &cxxflags) const = 0
|
2013-09-10 17:16:10 +02:00
|
|
|
Converts tool chain specific flags to list flags that tune the libclang
|
|
|
|
|
parser.
|
2013-03-03 21:53:38 +04:00
|
|
|
*/
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\fn bool ProjectExplorer::ToolChainFactory::canRestore(const QVariantMap &data)
|
2013-09-10 17:16:10 +02:00
|
|
|
Used by the tool chain manager to restore user-generated tool chains.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
2009-03-16 18:13:45 +01:00
|
|
|
|
2015-07-19 10:59:06 +03:00
|
|
|
QList<ToolChain *> ToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2015-07-19 10:59:06 +03:00
|
|
|
Q_UNUSED(alreadyKnown);
|
2011-02-01 18:36:00 +01:00
|
|
|
return QList<ToolChain *>();
|
2010-03-04 15:23:02 +01:00
|
|
|
}
|
2009-02-10 15:34:25 +01:00
|
|
|
|
2017-02-07 13:13:06 +01:00
|
|
|
QList<ToolChain *> ToolChainFactory::autoDetect(const Utils::FileName &compilerPath, const Core::Id &language)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(compilerPath);
|
|
|
|
|
Q_UNUSED(language);
|
|
|
|
|
return QList<ToolChain *>();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChainFactory::canCreate()
|
2010-03-04 15:23:02 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
return false;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2016-12-16 00:43:14 +01:00
|
|
|
ToolChain *ToolChainFactory::create(Core::Id l)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2016-07-12 15:08:53 +02:00
|
|
|
Q_UNUSED(l);
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
bool ToolChainFactory::canRestore(const QVariantMap &)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2011-02-01 18:36:00 +01:00
|
|
|
return false;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
ToolChain *ToolChainFactory::restore(const QVariantMap &)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2015-07-07 14:20:12 +02:00
|
|
|
static QPair<QString, QString> rawIdData(const QVariantMap &data)
|
|
|
|
|
{
|
|
|
|
|
const QString raw = data.value(QLatin1String(ID_KEY)).toString();
|
|
|
|
|
const int pos = raw.indexOf(QLatin1Char(':'));
|
|
|
|
|
QTC_ASSERT(pos > 0, return qMakePair(QString::fromLatin1("unknown"), QString::fromLatin1("unknown")));
|
|
|
|
|
return qMakePair(raw.mid(0, pos), raw.mid(pos + 1));
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-07 12:01:22 +02:00
|
|
|
QByteArray ToolChainFactory::idFromMap(const QVariantMap &data)
|
2009-02-10 15:34:25 +01:00
|
|
|
{
|
2015-07-07 14:20:12 +02:00
|
|
|
return rawIdData(data).second.toUtf8();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Core::Id ToolChainFactory::typeIdFromMap(const QVariantMap &data)
|
|
|
|
|
{
|
|
|
|
|
return Core::Id::fromString(rawIdData(data).first);
|
2009-02-10 15:34:25 +01:00
|
|
|
}
|
|
|
|
|
|
2012-06-20 15:45:37 +02:00
|
|
|
void ToolChainFactory::autoDetectionToMap(QVariantMap &data, bool detected)
|
|
|
|
|
{
|
|
|
|
|
data.insert(QLatin1String(AUTODETECT_KEY), detected);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-01 18:36:00 +01:00
|
|
|
} // namespace ProjectExplorer
|