From 329e0e584e9efd587c77a70e18dfd3c506110a75 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 20 Jun 2012 15:38:40 +0200 Subject: [PATCH] Fix maemo toolchain handling Upgrade Maemo toolchains to normal gcc ones. Change-Id: I30b1ec42b42de728efa81ef2e54d75d0e4afd565 Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/gcctoolchain.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 51fee9020cd..4a295cc5356 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -63,6 +63,8 @@ static const char compilerCommandKeyC[] = "ProjectExplorer.GccToolChain.Path"; static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi"; static const char supportedAbisKeyC[] = "ProjectExplorer.GccToolChain.SupportedAbis"; +static const char LEGACY_MAEMO_ID[] = "Qt4ProjectManager.ToolChain.Maemo:"; + static QByteArray runGcc(const Utils::FileName &gcc, const QStringList &arguments, const QStringList &env) { if (gcc.isEmpty() || !gcc.toFileInfo().isExecutable()) @@ -602,13 +604,23 @@ QList Internal::GccToolChainFactory::autoDetect() // Used by the ToolChainManager to restore user-generated tool chains bool Internal::GccToolChainFactory::canRestore(const QVariantMap &data) { - return idFromMap(data).startsWith(QLatin1String(Constants::GCC_TOOLCHAIN_ID) + QLatin1Char(':')); + const QString id = idFromMap(data); + return id.startsWith(QLatin1String(Constants::GCC_TOOLCHAIN_ID) + QLatin1Char(':')) + || id.startsWith(QLatin1String(LEGACY_MAEMO_ID)); } ToolChain *Internal::GccToolChainFactory::restore(const QVariantMap &data) { GccToolChain *tc = new GccToolChain(false); - if (tc->fromMap(data)) + // Updating from 2.5: + QVariantMap updated = data; + QString id = idFromMap(updated); + if (id.startsWith(LEGACY_MAEMO_ID)) { + id = QString::fromLatin1(Constants::GCC_TOOLCHAIN_ID).append(id.mid(id.indexOf(QLatin1Char(':')))); + idToMap(updated, id); + autoDetectionToMap(updated, false); + } + if (tc->fromMap(updated)) return tc; delete tc;