diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-02-19 22:16:04 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-02-25 15:58:40 +0000 |
commit | 0876dc4d6abb147ccdcc190adfad01c704a73e61 (patch) | |
tree | e8a1d558827e2a9e4092600cbe1a2029895d9f99 /src/app/qbs-setup-toolchains | |
parent | e160b26d8c7476c63f6220ac69d1d6405e8ce3aa (diff) |
Use QStringLiteral more where it is possible
Change-Id: I7419cc3fbc1e8776de3943852dcedab4c95d1c32
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/app/qbs-setup-toolchains')
-rw-r--r-- | src/app/qbs-setup-toolchains/commandlineparser.cpp | 12 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/msvcprobe.cpp | 10 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/probe.cpp | 67 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/xcodeprobe.cpp | 18 |
4 files changed, 53 insertions, 54 deletions
diff --git a/src/app/qbs-setup-toolchains/commandlineparser.cpp b/src/app/qbs-setup-toolchains/commandlineparser.cpp index d96e18b7d..bf3937a2f 100644 --- a/src/app/qbs-setup-toolchains/commandlineparser.cpp +++ b/src/app/qbs-setup-toolchains/commandlineparser.cpp @@ -45,12 +45,12 @@ using qbs::Internal::Tr; -static QString helpOptionShort() { return QLatin1String("-h"); } -static QString helpOptionLong() { return QLatin1String("--help"); } -static QString detectOption() { return QLatin1String("--detect"); } -static QString typeOption() { return QLatin1String("--type"); } -static QString settingsDirOption() { return QLatin1String("--settings-dir"); } -static QString systemOption() { return QLatin1String("--system"); } +static QString helpOptionShort() { return QStringLiteral("-h"); } +static QString helpOptionLong() { return QStringLiteral("--help"); } +static QString detectOption() { return QStringLiteral("--detect"); } +static QString typeOption() { return QStringLiteral("--type"); } +static QString settingsDirOption() { return QStringLiteral("--settings-dir"); } +static QString systemOption() { return QStringLiteral("--system"); } void CommandLineParser::parse(const QStringList &commandLine) { diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp index 967d443a2..267f9628d 100644 --- a/src/app/qbs-setup-toolchains/msvcprobe.cpp +++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp @@ -92,9 +92,9 @@ static void addMSVCPlatform(Settings *settings, QList<Profile> &profiles, QStrin qbsInfo() << Tr::tr("Setting up profile '%1'.").arg(name); Profile p(name, settings); p.removeProfile(); - p.setValue(QLatin1String("qbs.targetPlatform"), QLatin1String("windows")); - p.setValue(QLatin1String("qbs.toolchain"), QStringList(QLatin1String("msvc"))); - p.setValue(QLatin1String("cpp.toolchainInstallPath"), msvc->binPath); + p.setValue(QStringLiteral("qbs.targetPlatform"), QStringLiteral("windows")); + p.setValue(QStringLiteral("qbs.toolchain"), QStringList(QStringLiteral("msvc"))); + p.setValue(QStringLiteral("cpp.toolchainInstallPath"), msvc->binPath); setQtHelperProperties(p, msvc); profiles.push_back(p); } @@ -154,7 +154,7 @@ static std::vector<MSVCArchInfo> findSupportedArchitectures(const MSVC &msvc) static QString wow6432Key() { #ifdef Q_OS_WIN64 - return QLatin1String("\\Wow6432Node"); + return QStringLiteral("\\Wow6432Node"); #else return QString(); #endif @@ -351,7 +351,7 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles) const QSettings sdkRegistry(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key() + QLatin1String("\\Microsoft\\Microsoft SDKs\\Windows"), QSettings::NativeFormat); - const QString defaultSdkPath = sdkRegistry.value(QLatin1String("CurrentInstallFolder")).toString(); + const QString defaultSdkPath = sdkRegistry.value(QStringLiteral("CurrentInstallFolder")).toString(); if (!defaultSdkPath.isEmpty()) { const auto sdkKeys = sdkRegistry.childGroups(); for (const QString &sdkKey : sdkKeys) { diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp index 390b539a4..9ae8eac94 100644 --- a/src/app/qbs-setup-toolchains/probe.cpp +++ b/src/app/qbs-setup-toolchains/probe.cpp @@ -101,16 +101,16 @@ static QStringList validMinGWMachines() { // List of MinGW machine names (gcc -dumpmachine) recognized by Qbs return QStringList() - << QLatin1String("mingw32") << QLatin1String("mingw64") - << QLatin1String("i686-w64-mingw32") << QLatin1String("x86_64-w64-mingw32") - << QLatin1String("i686-w64-mingw32.shared") << QLatin1String("x86_64-w64-mingw32.shared") - << QLatin1String("i686-w64-mingw32.static") << QLatin1String("x86_64-w64-mingw32.static") - << QLatin1String("i586-mingw32msvc") << QLatin1String("amd64-mingw32msvc"); + << QStringLiteral("mingw32") << QStringLiteral("mingw64") + << QStringLiteral("i686-w64-mingw32") << QStringLiteral("x86_64-w64-mingw32") + << QStringLiteral("i686-w64-mingw32.shared") << QStringLiteral("x86_64-w64-mingw32.shared") + << QStringLiteral("i686-w64-mingw32.static") << QStringLiteral("x86_64-w64-mingw32.static") + << QStringLiteral("i586-mingw32msvc") << QStringLiteral("amd64-mingw32msvc"); } static QStringList knownIarCompilerNames() { - return { QLatin1String("icc8051"), QLatin1String("iccarm"), QLatin1String("iccavr") }; + return { QStringLiteral("icc8051"), QStringLiteral("iccarm"), QStringLiteral("iccavr") }; } static bool isIarCompiler(const QString &compilerName) @@ -135,25 +135,25 @@ static bool isKeilCompiler(const QString &compilerName) static QStringList toolchainTypeFromCompilerName(const QString &compilerName) { if (compilerName == QLatin1String("cl.exe")) - return canonicalToolchain(QLatin1String("msvc")); - const auto types = { QLatin1String("clang"), QLatin1String("llvm"), - QLatin1String("mingw"), QLatin1String("gcc") }; + return canonicalToolchain(QStringLiteral("msvc")); + const auto types = { QStringLiteral("clang"), QStringLiteral("llvm"), + QStringLiteral("mingw"), QStringLiteral("gcc") }; for (const auto &type : types) { if (compilerName.contains(type)) return canonicalToolchain(type); } if (compilerName == QLatin1String("g++")) - return canonicalToolchain(QLatin1String("gcc")); + return canonicalToolchain(QStringLiteral("gcc")); if (isIarCompiler(compilerName)) - return canonicalToolchain(QLatin1String("iar")); + return canonicalToolchain(QStringLiteral("iar")); if (isKeilCompiler(compilerName)) - return canonicalToolchain(QLatin1String("keil")); + return canonicalToolchain(QStringLiteral("keil")); return QStringList(); } static QString gccMachineName(const QString &compilerFilePath) { - return qsystem(compilerFilePath, QStringList() << QLatin1String("-dumpmachine")).trimmed(); + return qsystem(compilerFilePath, QStringList() << QStringLiteral("-dumpmachine")).trimmed(); } static QStringList standardCompilerFileNames() @@ -176,15 +176,15 @@ static void setCommonProperties(Profile &profile, const QString &compilerFilePat const QString prefix = compilerName.left(compilerName.lastIndexOf(QLatin1Char('-')) + 1); if (!prefix.isEmpty()) - profile.setValue(QLatin1String("cpp.toolchainPrefix"), prefix); + profile.setValue(QStringLiteral("cpp.toolchainPrefix"), prefix); - profile.setValue(QLatin1String("cpp.toolchainInstallPath"), cfi.absolutePath()); - profile.setValue(QLatin1String("qbs.toolchain"), toolchainTypes); + profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), cfi.absolutePath()); + profile.setValue(QStringLiteral("qbs.toolchain"), toolchainTypes); const QString suffix = compilerName.right(compilerName.size() - prefix.size()); if (!standardCompilerFileNames().contains(suffix)) qWarning("%s", qPrintable( - QString::fromLatin1("'%1' is not a standard compiler file name; " + QStringLiteral("'%1' is not a standard compiler file name; " "you must set the cpp.cCompilerName and " "cpp.cxxCompilerName properties of this profile " "manually").arg(compilerName))); @@ -205,9 +205,8 @@ public: return; const QString toolFilePath = findExecutable(toolFileName); if (toolFilePath.isEmpty()) { - qWarning("%s", qPrintable( - QString(QLatin1String("'%1' exists neither in '%2' nor in PATH.")) - .arg(toolFileName, m_compilerDirPath))); + qWarning("%s", qPrintable(QStringLiteral("'%1' exists neither in '%2' nor in PATH.") + .arg(toolFileName, m_compilerDirPath))); } m_profile->setValue(propertyName, toolFilePath); } @@ -251,14 +250,14 @@ static Profile createGccProfile(const QString &compilerFilePath, Settings *setti const ToolPathSetup toolPathSetup(&profile, compilerDirPath, profile.value(QStringLiteral("cpp.toolchainPrefix")) .toString()); - toolPathSetup.apply(QLatin1String("ar"), QLatin1String("cpp.archiverPath")); - toolPathSetup.apply(QLatin1String("as"), QLatin1String("cpp.assemblerPath")); - toolPathSetup.apply(QLatin1String("nm"), QLatin1String("cpp.nmPath")); + toolPathSetup.apply(QStringLiteral("ar"), QStringLiteral("cpp.archiverPath")); + toolPathSetup.apply(QStringLiteral("as"), QStringLiteral("cpp.assemblerPath")); + toolPathSetup.apply(QStringLiteral("nm"), QStringLiteral("cpp.nmPath")); if (doesProfileTargetOS(profile, QStringLiteral("darwin"))) - toolPathSetup.apply(QLatin1String("dsymutil"), QLatin1String("cpp.dsymutilPath")); + toolPathSetup.apply(QStringLiteral("dsymutil"), QStringLiteral("cpp.dsymutilPath")); else - toolPathSetup.apply(QLatin1String("objcopy"), QLatin1String("cpp.objcopyPath")); - toolPathSetup.apply(QLatin1String("strip"), QLatin1String("cpp.stripPath")); + toolPathSetup.apply(QStringLiteral("objcopy"), QStringLiteral("cpp.objcopyPath")); + toolPathSetup.apply(QStringLiteral("strip"), QStringLiteral("cpp.stripPath")); qStdout << Tr::tr("Profile '%1' created for '%2'.").arg(profile.name(), compilerFilePath) << endl; @@ -269,11 +268,11 @@ static QString guessIarArchitecture(const QFileInfo &compiler) { const auto baseName = compiler.baseName(); if (baseName == QLatin1String("icc8051")) - return QLatin1String("mcs51"); + return QStringLiteral("mcs51"); if (baseName == QLatin1String("iccarm")) - return QLatin1String("arm"); + return QStringLiteral("arm"); if (baseName == QLatin1String("iccavr")) - return QLatin1String("avr"); + return QStringLiteral("avr"); return {}; } @@ -350,7 +349,7 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles) // List of possible compiler binary names for this platform QStringList compilerNames; if (HostOsInfo::isWindowsHost()) { - compilerNames << QLatin1String("gcc"); + compilerNames << QStringLiteral("gcc"); } else { const auto machineNames = validMinGWMachines(); for (const QString &machineName : machineNames) { @@ -363,7 +362,7 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles) = findExecutable(HostOsInfo::appendExecutableSuffix(compilerName)); if (!gccPath.isEmpty()) profiles.push_back(createGccProfile(gccPath, settings, - canonicalToolchain(QLatin1String("mingw")))); + canonicalToolchain(QStringLiteral("mingw")))); } } @@ -409,8 +408,8 @@ void probe(Settings *settings) if (HostOsInfo::isWindowsHost()) { msvcProbe(settings, profiles); } else { - gccProbe(settings, profiles, QLatin1String("gcc")); - gccProbe(settings, profiles, QLatin1String("clang")); + gccProbe(settings, profiles, QStringLiteral("gcc")); + gccProbe(settings, profiles, QStringLiteral("clang")); if (HostOsInfo::isMacosHost()) { xcodeProbe(settings, profiles); @@ -426,7 +425,7 @@ void probe(Settings *settings) } else if (profiles.size() == 1 && settings->defaultProfile().isEmpty()) { const QString profileName = profiles.front().name(); qStdout << Tr::tr("Making profile '%1' the default.").arg(profileName) << endl; - settings->setValue(QLatin1String("defaultProfile"), profileName); + settings->setValue(QStringLiteral("defaultProfile"), profileName); } } diff --git a/src/app/qbs-setup-toolchains/xcodeprobe.cpp b/src/app/qbs-setup-toolchains/xcodeprobe.cpp index 2cb54f5b9..277d14d0a 100644 --- a/src/app/qbs-setup-toolchains/xcodeprobe.cpp +++ b/src/app/qbs-setup-toolchains/xcodeprobe.cpp @@ -99,8 +99,8 @@ bool XcodeProbe::addDeveloperPath(const QString &path) void XcodeProbe::detectDeveloperPaths() { QProcess selectedXcode; - QString program = QLatin1String("/usr/bin/xcode-select"); - QStringList arguments(QLatin1String("--print-path")); + QString program = QStringLiteral("/usr/bin/xcode-select"); + QStringList arguments(QStringLiteral("--print-path")); selectedXcode.start(program, arguments, QProcess::ReadOnly); if (!selectedXcode.waitForFinished(-1) || selectedXcode.exitCode()) { qbsInfo() << Tr::tr("Could not detect selected Xcode with /usr/bin/xcode-select"); @@ -111,8 +111,8 @@ void XcodeProbe::detectDeveloperPaths() addDeveloperPath(defaultDeveloperPath); QProcess launchServices; - program = QLatin1String("/usr/bin/mdfind"); - arguments = QStringList(QLatin1String("kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'")); + program = QStringLiteral("/usr/bin/mdfind"); + arguments = QStringList(QStringLiteral("kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode'")); launchServices.start(program, arguments, QProcess::ReadOnly); if (!launchServices.waitForFinished(-1) || launchServices.exitCode()) { qbsInfo() << Tr::tr("Could not detect additional Xcode installations with /usr/bin/mdfind"); @@ -172,10 +172,10 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x Profile installationProfile(xcodeName, settings); installationProfile.removeProfile(); installationProfile.setValue(QStringLiteral("qbs.toolchain"), QStringList() - << QLatin1String("xcode") - << QLatin1String("clang") - << QLatin1String("llvm") - << QLatin1String("gcc")); + << QStringLiteral("xcode") + << QStringLiteral("clang") + << QStringLiteral("llvm") + << QStringLiteral("gcc")); if (devPath != defaultDeveloperPath) installationProfile.setValue(QStringLiteral("xcode.developerPath"), devPath); profiles.push_back(installationProfile); @@ -212,7 +212,7 @@ void XcodeProbe::detectAll() int i = 1; detectDeveloperPaths(); for (const QString &developerPath : developerPaths) { - QString profileName = QLatin1String("xcode"); + QString profileName = QStringLiteral("xcode"); if (developerPath != defaultDeveloperPath) { const auto devPath = developerPath.toStdString(); std::smatch match; |