forked from qt-creator/qt-creator
ProjectExplorer: Simplify Language Ids
Language ids are exposed via the MacroExpander to the user. So remove the
prefix and only leave the bare essential (C and Cxx), so that
%{Compiler::Executable:Cxx} continues to work.
Add code to transition kits and toolchains to the new Ids.
Change-Id: I012e5fd405b09032418c90d2517aede21cfa1b47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
@@ -239,6 +239,20 @@ void ToolChainKitInformation::upgrade(Kit *k)
|
|||||||
k->setSticky(ToolChainKitInformation::id(), k->isSticky(oldIdV2));
|
k->setSticky(ToolChainKitInformation::id(), k->isSticky(oldIdV2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// upgrade 4.3-temporary-master-state to 4.3:
|
||||||
|
{
|
||||||
|
const QVariantMap valueMap = k->value(ToolChainKitInformation::id()).toMap();
|
||||||
|
QVariantMap result;
|
||||||
|
for (const QString &key : valueMap.keys()) {
|
||||||
|
const int pos = key.lastIndexOf('.');
|
||||||
|
if (pos >= 0)
|
||||||
|
result.insert(key.mid(pos + 1), valueMap.value(key));
|
||||||
|
else
|
||||||
|
result.insert(key, valueMap.value(key));
|
||||||
|
}
|
||||||
|
k->setValue(ToolChainKitInformation::id(), result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolChainKitInformation::fix(Kit *k)
|
void ToolChainKitInformation::fix(Kit *k)
|
||||||
|
|||||||
@@ -210,8 +210,10 @@ const char BUILDSTEPS_DEPLOY[] = "ProjectExplorer.BuildSteps.Deploy";
|
|||||||
const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConfiguration";
|
const char DEFAULT_DEPLOYCONFIGURATION_ID[] = "ProjectExplorer.DefaultDeployConfiguration";
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
const char C_LANGUAGE_ID[] = "ProjectExplorer.Language.C";
|
|
||||||
const char CXX_LANGUAGE_ID[] = "ProjectExplorer.Language.Cxx";
|
// Keep these short: These constants are exposed to the MacroExplorer!
|
||||||
|
const char C_LANGUAGE_ID[] = "C";
|
||||||
|
const char CXX_LANGUAGE_ID[] = "Cxx";
|
||||||
|
|
||||||
// ToolChain TypeIds
|
// ToolChain TypeIds
|
||||||
const char CLANG_TOOLCHAIN_TYPEID[] = "ProjectExplorer.ToolChain.Clang";
|
const char CLANG_TOOLCHAIN_TYPEID[] = "ProjectExplorer.ToolChain.Clang";
|
||||||
|
|||||||
@@ -262,10 +262,18 @@ bool ToolChain::fromMap(const QVariantMap &data)
|
|||||||
const bool autoDetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
|
const bool autoDetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
|
||||||
d->m_detection = autoDetect ? AutoDetectionFromSettings : ManualDetection;
|
d->m_detection = autoDetect ? AutoDetectionFromSettings : ManualDetection;
|
||||||
|
|
||||||
if (data.contains(LANGUAGE_KEY_V2))
|
if (data.contains(LANGUAGE_KEY_V2)) {
|
||||||
d->m_language = Core::Id::fromSetting(data.value(QLatin1String(LANGUAGE_KEY_V2)));
|
// remove hack to trim language id in 4.4: This is to fix up broken language
|
||||||
else if (data.contains(LANGUAGE_KEY_V1)) // Import from old settings
|
// 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
|
||||||
d->m_language = Internal::fromLanguageV1(data.value(QLatin1String(LANGUAGE_KEY_V1)).toInt());
|
d->m_language = Internal::fromLanguageV1(data.value(QLatin1String(LANGUAGE_KEY_V1)).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
if (!d->m_language.isValid())
|
if (!d->m_language.isValid())
|
||||||
d->m_language = Core::Id(Constants::CXX_LANGUAGE_ID);
|
d->m_language = Core::Id(Constants::CXX_LANGUAGE_ID);
|
||||||
|
|||||||
Reference in New Issue
Block a user