Commit 1226400a authored by Friedemann Kleint's avatar Friedemann Kleint

Introduce an enumeration for toolchain autodetection.

Replace boolean "autodetect" by an enumeration with a value
AutoDetectionFromSettings indicating whether the Autodetection
originates from a settings file. Enable the "Remove" button for
those cases.

Currently, there is no way to remove toolchains that were once
autodetected and are no longer present. This happens for example
when working in different MinGW environments, which then
clutter up the toolchain options page and dramatically slow
down the options page opening since gcc is launched to query
the flags, etc.

Change-Id: I731168d8694fe56f60d909f9779f83cffa55fd44
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent f1d18ba3
......@@ -66,8 +66,8 @@ static const char ANDROID_NDK_TC_VERION[] = "Qt4ProjectManager.Android.NDK_TC_VE
QMap<ProjectExplorer::Abi::Architecture, QList<int> > AndroidToolChainFactory::m_newestVersionForArch;
Utils::FileName AndroidToolChainFactory::m_ndkLocation;
AndroidToolChain::AndroidToolChain(Abi::Architecture arch, const QString &ndkToolChainVersion, bool autodetected)
: GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), autodetected),
AndroidToolChain::AndroidToolChain(Abi::Architecture arch, const QString &ndkToolChainVersion, Detection d)
: GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), d),
m_ndkToolChainVersion(ndkToolChainVersion), m_secondaryToolChain(false)
{
ProjectExplorer::Abi abi = ProjectExplorer::Abi(arch, ProjectExplorer::Abi::LinuxOS,
......@@ -81,7 +81,7 @@ AndroidToolChain::AndroidToolChain(Abi::Architecture arch, const QString &ndkToo
// for fromMap
AndroidToolChain::AndroidToolChain()
: GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), false),
: GccToolChain(QLatin1String(Constants::ANDROID_TOOLCHAIN_ID), ToolChain::ManualDetection),
m_secondaryToolChain(false)
{
}
......@@ -383,7 +383,7 @@ QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::
Abi::Architecture arch = AndroidConfigurations::architectureForToolChainPrefix(platform);
if (arch == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
continue;
AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
AndroidToolChain *tc = new AndroidToolChain(arch, version, ToolChain::AutoDetection);
FileName compilerPath = AndroidConfigurations::instance().gccPath(arch, version);
tc->setCompilerCommand(compilerPath);
result.append(tc);
......
......@@ -68,7 +68,7 @@ protected:
QList<ProjectExplorer::Abi> detectSupportedAbis() const;
private:
AndroidToolChain(ProjectExplorer::Abi::Architecture arch, const QString &ndkToolChainVersion, bool autodetected);
explicit AndroidToolChain(ProjectExplorer::Abi::Architecture arch, const QString &ndkToolChainVersion, Detection d);
AndroidToolChain();
AndroidToolChain(const AndroidToolChain &);
......
......@@ -47,10 +47,10 @@ namespace Internal {
AbstractMsvcToolChain::AbstractMsvcToolChain(const QString &id,
bool autodetect,
Detection d,
const Abi &abi,
const QString& vcvarsBat) :
ToolChain(id, autodetect),
ToolChain(id, d),
m_lastEnvironment(Utils::Environment::systemEnvironment()),
m_abi(abi),
m_vcvarsBat(vcvarsBat)
......@@ -61,8 +61,8 @@ AbstractMsvcToolChain::AbstractMsvcToolChain(const QString &id,
Q_ASSERT(!m_vcvarsBat.isEmpty());
}
AbstractMsvcToolChain::AbstractMsvcToolChain(const QString &id, bool autodetect) :
ToolChain(id, autodetect),
AbstractMsvcToolChain::AbstractMsvcToolChain(const QString &id, Detection d) :
ToolChain(id, d),
m_lastEnvironment(Utils::Environment::systemEnvironment())
{
......
......@@ -43,8 +43,8 @@ namespace Internal {
class PROJECTEXPLORER_EXPORT AbstractMsvcToolChain : public ToolChain
{
public:
AbstractMsvcToolChain(const QString &id, bool autodetect, const Abi &abi, const QString& vcvarsBat);
AbstractMsvcToolChain(const QString &id, bool autodetect);
explicit AbstractMsvcToolChain(const QString &id, Detection d, const Abi &abi, const QString& vcvarsBat);
explicit AbstractMsvcToolChain(const QString &id, Detection d);
Abi targetAbi() const;
......
......@@ -76,13 +76,13 @@ static const char messageCapKeyC[] = "ProjectExplorer.CustomToolChain.MessageCap
// CustomToolChain
// --------------------------------------------------------------------------
CustomToolChain::CustomToolChain(bool autodetect) :
ToolChain(QLatin1String(Constants::CUSTOM_TOOLCHAIN_ID), autodetect),
CustomToolChain::CustomToolChain(Detection d) :
ToolChain(QLatin1String(Constants::CUSTOM_TOOLCHAIN_ID), d),
m_outputParser(Gcc)
{ }
CustomToolChain::CustomToolChain(const QString &id, bool autodetect) :
ToolChain(id, autodetect)
CustomToolChain::CustomToolChain(const QString &id, Detection d) :
ToolChain(id, d)
{ }
CustomToolChain::CustomToolChain(const CustomToolChain &tc) :
......@@ -416,7 +416,7 @@ bool CustomToolChainFactory::canRestore(const QVariantMap &data)
ToolChain *CustomToolChainFactory::restore(const QVariantMap &data)
{
CustomToolChain *tc = new CustomToolChain(false);
CustomToolChain *tc = new CustomToolChain(ToolChain::ManualDetection);
if (tc->fromMap(data))
return tc;
......@@ -426,7 +426,7 @@ ToolChain *CustomToolChainFactory::restore(const QVariantMap &data)
CustomToolChain *CustomToolChainFactory::createToolChain(bool autoDetect)
{
return new CustomToolChain(autoDetect);
return new CustomToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
}
// --------------------------------------------------------------------------
......
......@@ -122,11 +122,11 @@ public:
static QString parserName(OutputParser parser);
protected:
CustomToolChain(const QString &id, bool autodetect);
explicit CustomToolChain(const QString &id, Detection d);
CustomToolChain(const CustomToolChain &);
private:
CustomToolChain(bool autodetect);
explicit CustomToolChain(Detection d);
Utils::FileName m_compilerCommand;
Utils::FileName m_makeCommand;
......
......@@ -281,12 +281,12 @@ static QString gccVersion(const FileName &path, const QStringList &env)
// GccToolChain
// --------------------------------------------------------------------------
GccToolChain::GccToolChain(bool autodetect) :
ToolChain(QLatin1String(Constants::GCC_TOOLCHAIN_ID), autodetect)
GccToolChain::GccToolChain(Detection d) :
ToolChain(QLatin1String(Constants::GCC_TOOLCHAIN_ID), d)
{ }
GccToolChain::GccToolChain(const QString &id, bool autodetect) :
ToolChain(id, autodetect)
GccToolChain::GccToolChain(const QString &id, Detection d) :
ToolChain(id, d)
{ }
GccToolChain::GccToolChain(const GccToolChain &tc) :
......@@ -754,7 +754,7 @@ bool GccToolChainFactory::canRestore(const QVariantMap &data)
ToolChain *GccToolChainFactory::restore(const QVariantMap &data)
{
GccToolChain *tc = new GccToolChain(false);
GccToolChain *tc = new GccToolChain(ToolChain::ManualDetection);
// Updating from 2.5:
QVariantMap updated = data;
QString id = idFromMap(updated);
......@@ -772,7 +772,7 @@ ToolChain *GccToolChainFactory::restore(const QVariantMap &data)
GccToolChain *GccToolChainFactory::createToolChain(bool autoDetect)
{
return new GccToolChain(autoDetect);
return new GccToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
}
QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &compiler,
......@@ -953,8 +953,8 @@ void GccToolChainConfigWidget::handlePlatformLinkerFlagsChange()
// ClangToolChain
// --------------------------------------------------------------------------
ClangToolChain::ClangToolChain(bool autodetect) :
GccToolChain(QLatin1String(Constants::CLANG_TOOLCHAIN_ID), autodetect)
ClangToolChain::ClangToolChain(Detection d) :
GccToolChain(QLatin1String(Constants::CLANG_TOOLCHAIN_ID), d)
{ }
QString ClangToolChain::type() const
......@@ -1082,7 +1082,7 @@ bool ClangToolChainFactory::canRestore(const QVariantMap &data)
ToolChain *ClangToolChainFactory::restore(const QVariantMap &data)
{
ClangToolChain *tc = new ClangToolChain(false);
ClangToolChain *tc = new ClangToolChain(ToolChain::ManualDetection);
if (tc->fromMap(data))
return tc;
......@@ -1092,15 +1092,15 @@ ToolChain *ClangToolChainFactory::restore(const QVariantMap &data)
GccToolChain *ClangToolChainFactory::createToolChain(bool autoDetect)
{
return new ClangToolChain(autoDetect);
return new ClangToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
}
// --------------------------------------------------------------------------
// MingwToolChain
// --------------------------------------------------------------------------
MingwToolChain::MingwToolChain(bool autodetect) :
GccToolChain(QLatin1String(Constants::MINGW_TOOLCHAIN_ID), autodetect)
MingwToolChain::MingwToolChain(Detection d) :
GccToolChain(QLatin1String(Constants::MINGW_TOOLCHAIN_ID), d)
{ }
QString MingwToolChain::type() const
......@@ -1188,7 +1188,7 @@ bool MingwToolChainFactory::canRestore(const QVariantMap &data)
ToolChain *MingwToolChainFactory::restore(const QVariantMap &data)
{
MingwToolChain *tc = new MingwToolChain(false);
MingwToolChain *tc = new MingwToolChain(ToolChain::ManualDetection);
if (tc->fromMap(data))
return tc;
......@@ -1198,15 +1198,15 @@ ToolChain *MingwToolChainFactory::restore(const QVariantMap &data)
GccToolChain *MingwToolChainFactory::createToolChain(bool autoDetect)
{
return new MingwToolChain(autoDetect);
return new MingwToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
}
// --------------------------------------------------------------------------
// LinuxIccToolChain
// --------------------------------------------------------------------------
LinuxIccToolChain::LinuxIccToolChain(bool autodetect) :
GccToolChain(QLatin1String(Constants::LINUXICC_TOOLCHAIN_ID), autodetect)
LinuxIccToolChain::LinuxIccToolChain(Detection d) :
GccToolChain(QLatin1String(Constants::LINUXICC_TOOLCHAIN_ID), d)
{ }
QString LinuxIccToolChain::type() const
......@@ -1284,7 +1284,7 @@ bool LinuxIccToolChainFactory::canRestore(const QVariantMap &data)
ToolChain *LinuxIccToolChainFactory::restore(const QVariantMap &data)
{
LinuxIccToolChain *tc = new LinuxIccToolChain(false);
LinuxIccToolChain *tc = new LinuxIccToolChain(ToolChain::ManualDetection);
if (tc->fromMap(data))
return tc;
......@@ -1294,7 +1294,7 @@ ToolChain *LinuxIccToolChainFactory::restore(const QVariantMap &data)
GccToolChain *LinuxIccToolChainFactory::createToolChain(bool autoDetect)
{
return new LinuxIccToolChain(autoDetect);
return new LinuxIccToolChain(autoDetect ? ToolChain::AutoDetection : ToolChain::ManualDetection);
}
GccToolChain::WarningFlagAdder::WarningFlagAdder(const QString &flag, ToolChain::WarningFlags &flags) :
......
......@@ -55,7 +55,7 @@ class LinuxIccToolChainFactory;
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
{
public:
GccToolChain(const QString &id, bool autodetect);
GccToolChain(const QString &id, Detection d);
QString type() const;
QString typeDisplayName() const;
Abi targetAbi() const;
......@@ -124,7 +124,7 @@ protected:
};
private:
GccToolChain(bool autodetect);
explicit GccToolChain(Detection d);
void updateSupportedAbis() const;
......@@ -166,7 +166,7 @@ protected:
virtual CompilerFlags defaultCompilerFlags() const;
private:
ClangToolChain(bool autodetect);
explicit ClangToolChain(Detection d);
friend class Internal::ClangToolChainFactory;
friend class ToolChainFactory;
......@@ -188,7 +188,7 @@ public:
QList<Utils::FileName> suggestedMkspecList() const;
private:
MingwToolChain(bool autodetect);
explicit MingwToolChain(Detection d);
friend class Internal::MingwToolChainFactory;
friend class ToolChainFactory;
......@@ -212,7 +212,7 @@ public:
QList<Utils::FileName> suggestedMkspecList() const;
private:
LinuxIccToolChain(bool autodetect);
explicit LinuxIccToolChain(Detection d);
friend class Internal::LinuxIccToolChainFactory;
friend class ToolChainFactory;
......
......@@ -304,8 +304,8 @@ Utils::Environment MsvcToolChain::readEnvironmentSetting(Utils::Environment& env
// --------------------------------------------------------------------------
MsvcToolChain::MsvcToolChain(const QString &name, const Abi &abi,
const QString &varsBat, const QString &varsBatArg, bool autodetect) :
AbstractMsvcToolChain(QLatin1String(Constants::MSVC_TOOLCHAIN_ID), autodetect, abi, varsBat),
const QString &varsBat, const QString &varsBatArg, Detection d) :
AbstractMsvcToolChain(QLatin1String(Constants::MSVC_TOOLCHAIN_ID), d, abi, varsBat),
m_varsBatArg(varsBatArg)
{
Q_ASSERT(!name.isEmpty());
......@@ -322,7 +322,7 @@ bool MsvcToolChain::isValid() const
}
MsvcToolChain::MsvcToolChain() :
AbstractMsvcToolChain(QLatin1String(Constants::MSVC_TOOLCHAIN_ID), false)
AbstractMsvcToolChain(QLatin1String(Constants::MSVC_TOOLCHAIN_ID), ManualDetection)
{
}
......@@ -497,14 +497,14 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
QList<ToolChain *> tmp;
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::x86),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::x86, sdkKey),
fi.absoluteFilePath(), QLatin1String("/x86"), true));
fi.absoluteFilePath(), QLatin1String("/x86"), ToolChain::AutoDetection));
// Add all platforms, cross-compiler is automatically selected by SetEnv.cmd if needed
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::amd64, sdkKey),
fi.absoluteFilePath(), QLatin1String("/x64"), true));
fi.absoluteFilePath(), QLatin1String("/x64"), ToolChain::AutoDetection));
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::ia64, sdkKey),
fi.absoluteFilePath(), QLatin1String("/ia64"), true));
fi.absoluteFilePath(), QLatin1String("/ia64"), ToolChain::AutoDetection));
// Make sure the default is front.
if (folder == defaultSdkPath)
results = tmp + results;
......@@ -539,23 +539,23 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
if (QFileInfo(vcVarsBatFor(path, QLatin1String("x86"))).isFile())
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::x86),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::x86, vsName),
vcvarsAllbat, QLatin1String("x86"), true));
vcvarsAllbat, QLatin1String("x86"), ToolChain::AutoDetection));
if (arch == Utils::HostOsInfo::HostArchitectureX86) {
if (QFileInfo(vcVarsBatFor(path, QLatin1String("x86_amd64"))).isFile())
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::amd64, vsName),
vcvarsAllbat, QLatin1String("x86_amd64"), true));
vcvarsAllbat, QLatin1String("x86_amd64"), ToolChain::AutoDetection));
} else if (arch == Utils::HostOsInfo::HostArchitectureAMD64) {
if (QFileInfo(vcVarsBatFor(path, QLatin1String("amd64"))).isFile()) {
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::amd64, vsName),
vcvarsAllbat, QLatin1String("amd64"), true));
vcvarsAllbat, QLatin1String("amd64"), ToolChain::AutoDetection));
} else if (QFileInfo(vcVarsBatFor(path, QLatin1String("x86_amd64"))).isFile()) {
// Fall back to 32 bit to 4 bit
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::amd64, vsName),
vcvarsAllbat, QLatin1String("x86_amd64"), true));
vcvarsAllbat, QLatin1String("x86_amd64"), ToolChain::AutoDetection));
}
}
......@@ -564,25 +564,25 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
if (QFileInfo(vcVarsBatFor(path, QLatin1String("x86_arm"))).isFile())
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::arm),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::arm, vsName),
vcvarsAllbat, QLatin1String("x86_arm"), true));
vcvarsAllbat, QLatin1String("x86_arm"), ToolChain::AutoDetection));
} else if (arch == Utils::HostOsInfo::HostArchitectureArm) {
if (QFileInfo(vcVarsBatFor(path, QLatin1String("arm"))).isFile())
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::arm),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::arm, vsName),
vcvarsAllbat, QLatin1String("arm"), true));
vcvarsAllbat, QLatin1String("arm"), ToolChain::AutoDetection));
}
if (arch == Utils::HostOsInfo::HostArchitectureItanium) {
if (QFileInfo(vcVarsBatFor(path, QLatin1String("ia64"))).isFile())
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::ia64, vsName),
vcvarsAllbat, QLatin1String("ia64"), true));
vcvarsAllbat, QLatin1String("ia64"), ToolChain::AutoDetection));
} else if (arch == Utils::HostOsInfo::HostArchitectureX86
|| arch == Utils::HostOsInfo::HostArchitectureAMD64) {
if (QFileInfo(vcVarsBatFor(path, QLatin1String("x86_ia64"))).isFile())
results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::ia64, vsName),
vcvarsAllbat, QLatin1String("x86_ia64"), true));
vcvarsAllbat, QLatin1String("x86_ia64"), ToolChain::AutoDetection));
}
} else {
qWarning("Unable to find MSVC setup script %s in version %d", qPrintable(vcvarsAllbat), version);
......
......@@ -54,7 +54,7 @@ public:
};
MsvcToolChain(const QString &name, const Abi &abi,
const QString &varsBat, const QString &varsBatArg, bool autodetect = false);
const QString &varsBat, const QString &varsBatArg, Detection d = ManualDetection);
bool isValid() const;
QList<Utils::FileName> suggestedMkspecList() const;
......
......@@ -53,8 +53,10 @@ namespace Internal {
class ToolChainPrivate
{
public:
ToolChainPrivate(const QString &id, bool autodetect) :
m_autodetect(autodetect)
typedef ToolChain::Detection Detection;
explicit ToolChainPrivate(const QString &id, Detection d) :
m_detection(d)
{
m_id = createId(id);
}
......@@ -67,7 +69,7 @@ public:
}
QString m_id;
bool m_autodetect;
Detection m_detection;
mutable QString m_displayName;
};
......@@ -81,12 +83,12 @@ public:
// --------------------------------------------------------------------------
ToolChain::ToolChain(const QString &id, bool autodetect) :
d(new Internal::ToolChainPrivate(id, autodetect))
ToolChain::ToolChain(const QString &id, Detection d) :
d(new Internal::ToolChainPrivate(id, d))
{ }
ToolChain::ToolChain(const ToolChain &other) :
d(new Internal::ToolChainPrivate(other.d->m_id, false))
d(new Internal::ToolChainPrivate(other.d->m_id, ManualDetection))
{
// leave the autodetection bit at false.
d->m_displayName = QCoreApplication::translate("ProjectExplorer::ToolChain", "Clone of %1")
......@@ -114,9 +116,9 @@ void ToolChain::setDisplayName(const QString &name)
toolChainUpdated();
}
bool ToolChain::isAutoDetected() const
ToolChain::Detection ToolChain::detection() const
{
return d->m_autodetect;
return d->m_detection;
}
QString ToolChain::id() const
......@@ -172,11 +174,11 @@ void ToolChain::toolChainUpdated()
ToolChainManager::notifyAboutUpdate(this);
}
void ToolChain::setAutoDetected(bool autodetect)
void ToolChain::setDetection(ToolChain::Detection de)
{
if (d->m_autodetect == autodetect)
if (d->m_detection == de)
return;
d->m_autodetect = autodetect;
d->m_detection = de;
toolChainUpdated();
}
......@@ -191,7 +193,8 @@ bool ToolChain::fromMap(const QVariantMap &data)
d->m_displayName = data.value(QLatin1String(DISPLAY_NAME_KEY)).toString();
// make sure we have new style ids:
d->m_id = data.value(QLatin1String(ID_KEY)).toString();
d->m_autodetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
const bool autoDetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
d->m_detection = autoDetect ? AutoDetectionFromSettings : ManualDetection;
return true;
}
......
......@@ -64,12 +64,20 @@ class Kit;
class PROJECTEXPLORER_EXPORT ToolChain
{
public:
enum Detection {
ManualDetection,
AutoDetection,
AutoDetectionFromSettings
};
virtual ~ToolChain();
QString displayName() const;
void setDisplayName(const QString &name);
bool isAutoDetected() const;
inline bool isAutoDetected() const { return detection() != ManualDetection; }
Detection detection() const;
QString id() const;
virtual QList<Utils::FileName> suggestedMkspecList() const;
......@@ -146,7 +154,7 @@ public:
virtual QVariantMap toMap() const;
virtual QList<Task> validateKit(const Kit *k) const;
protected:
ToolChain(const QString &id, bool autoDetect);
explicit ToolChain(const QString &id, Detection d);
explicit ToolChain(const ToolChain &);
void toolChainUpdated();
......@@ -155,7 +163,7 @@ protected:
virtual bool fromMap(const QVariantMap &data);
private:
void setAutoDetected(bool);
void setDetection(Detection d);
Internal::ToolChainPrivate *const d;
......
......@@ -198,7 +198,7 @@ void ToolChainManager::restoreToolChains()
restoreFromFile(FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME)));
// make sure we mark these as autodetected!
foreach (ToolChain *tc, readTcs)
tc->setAutoDetected(true);
tc->setDetection(ToolChain::AutoDetection);
tcsToRegister = readTcs; // SDK TCs are always considered to be up-to-date, so no need to
// recheck them.
......@@ -239,10 +239,12 @@ void ToolChainManager::restoreToolChains()
foreach (ToolChain *currentDetected, detectedTcs) {
toStore = currentDetected;
// Check whether we had this TC stored and prefer the old one with the old id:
// Check whether we had this TC stored and prefer the old one with the old id, marked
// as auto-detection.
for (int i = 0; i < tcsToCheck.count(); ++i) {
if (*(tcsToCheck.at(i)) == *currentDetected) {
toStore = tcsToCheck.at(i);
toStore->setDetection(ToolChain::AutoDetection);
tcsToCheck.removeAt(i);
delete currentDetected;
break;
......
......@@ -625,7 +625,7 @@ void ToolChainOptionsPage::updateState()
ToolChain *tc = m_model->toolChain(currentIndex());
if (tc) {
canCopy = tc->isValid() && tc->canClone();
canDelete = !tc->isAutoDetected();
canDelete = tc->detection() != ToolChain::AutoDetection;
}
m_cloneButton->setEnabled(canCopy);
......
......@@ -240,8 +240,8 @@ WinCEToolChain::WinCEToolChain(const QString &name,
const QString &binPath,
const QString &includePath,
const QString &libPath,
bool autodetect) :
AbstractMsvcToolChain(QLatin1String(Constants::WINCE_TOOLCHAIN_ID), autodetect, abi, vcvarsBat),
Detection d) :
AbstractMsvcToolChain(QLatin1String(Constants::WINCE_TOOLCHAIN_ID), d, abi, vcvarsBat),
m_msvcVer(msvcVer),
m_ceVer(ceVer),
m_binPath(binPath),
......@@ -257,7 +257,7 @@ WinCEToolChain::WinCEToolChain(const QString &name,
}
WinCEToolChain::WinCEToolChain() :
AbstractMsvcToolChain(QLatin1String(Constants::WINCE_TOOLCHAIN_ID), false)
AbstractMsvcToolChain(QLatin1String(Constants::WINCE_TOOLCHAIN_ID), ManualDetection)
{
}
......@@ -410,7 +410,7 @@ QList<ToolChain *> WinCEToolChainFactory::autoDetect()
binPath,
includePath,
libPath,
true);
ToolChain::AutoDetection);
results.append(pChain);
}
}
......
......@@ -48,7 +48,7 @@ public:
const QString &binPath,
const QString &includePath,
const QString &libPath,
bool autodetect = false);
Detection d = ManualDetection);
QList<Utils::FileName> suggestedMkspecList() const;
......
......@@ -231,7 +231,7 @@ GccToolChain *BlackBerryConfiguration::createGccToolChain()
}
}
GccToolChain* tc = new GccToolChain(QLatin1String(ProjectExplorer::Constants::GCC_TOOLCHAIN_ID), m_isAutoDetected);
GccToolChain* tc = new GccToolChain(QLatin1String(ProjectExplorer::Constants::GCC_TOOLCHAIN_ID), m_isAutoDetected ? ToolChain::AutoDetection : ToolChain::ManualDetection);
tc->setDisplayName(QString::fromLatin1("GCC BlackBerry 10 (%1)").arg(m_targetName));
tc->setCompilerCommand(m_gccCompiler);
......
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