Commit 49ae9766 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QbsProjectManager: Make DefaultPropertyProvider a bit more readable.



- Decrease indentation by exiting early.
- Use switch instead of "else if".

Change-Id: I74e73e087f64c16f01497854c67f581ef79aff3c
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
parent 869445b7
......@@ -67,7 +67,9 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
data.insert(QLatin1String(QBS_SYSROOT), sysroot);
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
if (tc) {
if (!tc)
return data;
// FIXME/CLARIFY: How to pass the sysroot?
ProjectExplorer::Abi targetAbi = tc->targetAbi();
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) {
......@@ -94,13 +96,15 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
qbs::Internal::HostOsInfo::canonicalArchitecture(architecture));
}
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
switch (targetAbi.os()) {
case ProjectExplorer::Abi::WindowsOS:
data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
data.insert(QLatin1String(QBS_TOOLCHAIN),
targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
: QStringList() << QLatin1String("msvc"));
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
break;
case ProjectExplorer::Abi::MacOS: {
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // from Ios::Constants (include header?)
const char IOS_SIMULATOR_TYPE[] = "Ios.Simulator.Type";
......@@ -133,7 +137,9 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
data.insert(QLatin1String(CPP_XCODESDKNAME), QString(re.cap(1).toLower() + re.cap(2)));
data.insert(QLatin1String(CPP_XCODESDKVERSION), re.cap(2));
}
} else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
break;
}
case ProjectExplorer::Abi::LinuxOS:
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
<< QLatin1String("unix"));
if (tc->type() != QLatin1String("clang")) {
......@@ -144,7 +150,8 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
<< QLatin1String("llvm")
<< QLatin1String("gcc"));
}
} else {
break;
default:
// TODO: Factor out toolchain type setting.
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("unix"));
if (tc->type() != QLatin1String("clang")) {
......@@ -156,6 +163,7 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
<< QLatin1String("gcc"));
}
}
Utils::FileName cxx = tc->compilerCommand();
const QFileInfo cxxFileInfo = cxx.toFileInfo();
QString compilerName = cxxFileInfo.fileName();
......@@ -173,7 +181,6 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
data.insert(QLatin1String(CPP_PLATFORMCFLAGS), flags);
data.insert(QLatin1String(CPP_PLATFORMCXXFLAGS), flags);
}
}
return data;
}
......
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