Commit d3c299cb authored by hjk's avatar hjk

ProjectExplorer: Streamline ToolchainFactory interface

Change-Id: I70dba496c4d1eeb9c6767080d179f86f20c1b107
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent bf6685bc
......@@ -243,18 +243,10 @@ AndroidToolChainConfigWidget::AndroidToolChainConfigWidget(AndroidToolChain *tc)
// ToolChainFactory
// --------------------------------------------------------------------------
AndroidToolChainFactory::AndroidToolChainFactory() :
ToolChainFactory()
{ }
QString AndroidToolChainFactory::displayName() const
{
return tr("Android GCC");
}
QString AndroidToolChainFactory::id() const
AndroidToolChainFactory::AndroidToolChainFactory()
{
return QLatin1String(Constants::ANDROID_TOOLCHAIN_ID);
setId(Constants::ANDROID_TOOLCHAIN_ID);
setDisplayName(tr("Android GCC"));
}
QList<ToolChain *> AndroidToolChainFactory::autoDetect()
......
......@@ -96,9 +96,6 @@ class AndroidToolChainFactory : public ProjectExplorer::ToolChainFactory
public:
AndroidToolChainFactory();
QString displayName() const;
QString id() const;
QList<ProjectExplorer::ToolChain *> autoDetect();
bool canRestore(const QVariantMap &data);
ProjectExplorer::ToolChain *restore(const QVariantMap &data);
......
......@@ -391,14 +391,10 @@ namespace Internal {
// CustomToolChainFactory
// --------------------------------------------------------------------------
QString CustomToolChainFactory::displayName() const
CustomToolChainFactory::CustomToolChainFactory()
{
return tr("Custom");
}
QString CustomToolChainFactory::id() const
{
return QLatin1String(Constants::CUSTOM_TOOLCHAIN_ID);
setId(Constants::CUSTOM_TOOLCHAIN_ID);
setDisplayName(tr("Custom"));
}
bool CustomToolChainFactory::canCreate()
......
......@@ -151,9 +151,7 @@ class CustomToolChainFactory : public ToolChainFactory
Q_OBJECT
public:
// Name used to display the name of the tool chain that will be created.
QString displayName() const;
QString id() const;
CustomToolChainFactory();
bool canCreate();
ToolChain *create();
......
......@@ -55,16 +55,13 @@ class GccToolChainFactory : public ToolChainFactory
Q_OBJECT
public:
// Name used to display the name of the tool chain that will be created.
QString displayName() const;
QString id() const;
GccToolChainFactory();
QList<ToolChain *> autoDetect();
bool canCreate();
ToolChain *create();
// Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data);
......@@ -116,16 +113,13 @@ class ClangToolChainFactory : public GccToolChainFactory
Q_OBJECT
public:
// Name used to display the name of the tool chain that will be created.
QString displayName() const;
QString id() const;
ClangToolChainFactory();
QList<ToolChain *> autoDetect();
bool canCreate();
ToolChain *create();
// Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data);
......@@ -142,16 +136,13 @@ class MingwToolChainFactory : public GccToolChainFactory
Q_OBJECT
public:
// Name used to display the name of the tool chain that will be created.
QString displayName() const;
QString id() const;
MingwToolChainFactory();
QList<ToolChain *> autoDetect();
bool canCreate();
ToolChain *create();
// Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data);
......@@ -168,15 +159,12 @@ class LinuxIccToolChainFactory : public GccToolChainFactory
Q_OBJECT
public:
// Name used to display the name of the tool chain that will be created.
QString displayName() const;
QString id() const;
LinuxIccToolChainFactory();
QList<ToolChain *> autoDetect();
ToolChain *create();
// Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data);
......
......@@ -429,14 +429,10 @@ void MsvcToolChainConfigWidget::setFromToolChain()
// MsvcToolChainFactory
// --------------------------------------------------------------------------
QString MsvcToolChainFactory::displayName() const
MsvcToolChainFactory::MsvcToolChainFactory()
{
return tr("MSVC");
}
QString MsvcToolChainFactory::id() const
{
return QLatin1String(Constants::MSVC_TOOLCHAIN_ID);
setId(Constants::MSVC_TOOLCHAIN_ID);
setDisplayName(tr("MSVC"));
}
bool MsvcToolChainFactory::checkForVisualStudioInstallation(const QString &vsName)
......
......@@ -94,13 +94,12 @@ class MsvcToolChainFactory : public ToolChainFactory
Q_OBJECT
public:
QString displayName() const;
QString id() const;
MsvcToolChainFactory();
QList<ToolChain *> autoDetect();
virtual bool canRestore(const QVariantMap &data);
virtual ToolChain *restore(const QVariantMap &data)
bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data)
{ return MsvcToolChain::readFromMap(data); }
ToolChainConfigWidget *configurationWidget(ToolChain *);
......
......@@ -31,6 +31,7 @@
#define TOOLCHAIN_H
#include "projectexplorer_export.h"
#include <coreplugin/id.h>
#include <QObject>
#include <QString>
......@@ -167,8 +168,8 @@ class PROJECTEXPLORER_EXPORT ToolChainFactory : public QObject
Q_OBJECT
public:
virtual QString displayName() const = 0;
virtual QString id() const = 0;
Core::Id id() const { return m_id; }
QString displayName() const { return m_displayName; }
virtual QList<ToolChain *> autoDetect();
......@@ -181,6 +182,14 @@ public:
static QString idFromMap(const QVariantMap &data);
static void idToMap(QVariantMap &data, const QString id);
static void autoDetectionToMap(QVariantMap &data, bool detected);
protected:
void setId(Core::Id id) { m_id = id; }
void setDisplayName(const QString &name) { m_displayName = name; }
private:
QString m_displayName;
Core::Id m_id;
};
} // namespace ProjectExplorer
......
......@@ -351,14 +351,10 @@ ToolChain *WinCEToolChain::clone() const
// WinCEToolChainFactory
// --------------------------------------------------------------------------
QString WinCEToolChainFactory::displayName() const
WinCEToolChainFactory::WinCEToolChainFactory()
{
return tr("WinCE");
}
QString WinCEToolChainFactory::id() const
{
return QLatin1String(Constants::WINCE_TOOLCHAIN_ID);
setId(Constants::WINCE_TOOLCHAIN_ID);
setDisplayName(tr("WinCE"));
}
......
......@@ -104,8 +104,7 @@ class WinCEToolChainFactory : public ToolChainFactory
Q_OBJECT
public:
QString displayName() const;
QString id() const;
WinCEToolChainFactory();
QList<ToolChain *> autoDetect();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment