aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2014-01-08 14:36:16 -0500
committerJake Petroules <jake.petroules@petroules.com>2014-01-14 17:41:47 +0100
commit49a051bd4b320aff32066181932dc27a4eea63c5 (patch)
treea8f5c6e56bb275d2ae8c83179065623385d1395a /src
parentcf706560d394e582a897d2a69e79ce5740d2459d (diff)
Prepare for using QT_NO_CAST_FROM/TO_ASCII.
Change-Id: Ib39e49e896cbddf5a5bd851088500991d962355a Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/app/config/configcommandexecutor.cpp4
-rw-r--r--src/app/config/configcommandlineparser.cpp22
-rw-r--r--src/app/detect-toolchains/msvcprobe.cpp18
-rw-r--r--src/app/detect-toolchains/probe.cpp86
-rw-r--r--src/app/detect-toolchains/xcodeprobe.cpp55
-rw-r--r--src/app/qbs-setup-qt/main.cpp7
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp80
-rw-r--r--src/app/qbs/parser/commandlineparser.cpp6
-rw-r--r--src/app/qbs/status.cpp28
-rw-r--r--src/lib/corelib/api/runenvironment.cpp2
-rw-r--r--src/lib/corelib/buildgraph/artifactcleaner.cpp2
-rw-r--r--src/lib/corelib/buildgraph/automoc.cpp10
-rw-r--r--src/lib/corelib/buildgraph/buildgraph.cpp14
-rw-r--r--src/lib/corelib/buildgraph/command.cpp82
-rw-r--r--src/lib/corelib/buildgraph/executor.cpp10
-rw-r--r--src/lib/corelib/buildgraph/inputartifactscanner.cpp13
-rw-r--r--src/lib/corelib/buildgraph/jscommandexecutor.cpp2
-rw-r--r--src/lib/corelib/buildgraph/processcommandexecutor.cpp12
-rw-r--r--src/lib/corelib/buildgraph/projectbuilddata.cpp6
-rw-r--r--src/lib/corelib/buildgraph/rulesapplicator.cpp56
-rw-r--r--src/lib/corelib/buildgraph/transformer.cpp19
-rw-r--r--src/lib/corelib/jsextensions/domxml.cpp6
-rw-r--r--src/lib/corelib/jsextensions/file.cpp10
-rw-r--r--src/lib/corelib/jsextensions/moduleproperties.cpp4
-rw-r--r--src/lib/corelib/jsextensions/process.cpp4
-rw-r--r--src/lib/corelib/jsextensions/textfile.cpp6
-rw-r--r--src/lib/corelib/language/builtindeclarations.cpp4
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp78
-rw-r--r--src/lib/corelib/language/itemreaderastvisitor.cpp27
-rw-r--r--src/lib/corelib/language/language.cpp19
-rw-r--r--src/lib/corelib/language/moduleloader.cpp10
-rw-r--r--src/lib/corelib/language/projectresolver.cpp46
-rw-r--r--src/lib/corelib/language/scriptengine.cpp2
-rw-r--r--src/lib/corelib/logging/ilogsink.cpp2
-rw-r--r--src/lib/corelib/logging/logger.cpp4
-rw-r--r--src/lib/corelib/tools/qbsassert.cpp4
-rw-r--r--src/lib/corelib/tools/scannerpluginmanager.cpp6
-rw-r--r--src/lib/corelib/tools/scripttools.cpp26
-rw-r--r--src/lib/corelib/tools/setupprojectparameters.cpp4
-rw-r--r--src/plugins/scanner/qt/qtscanner.cpp2
40 files changed, 444 insertions, 354 deletions
diff --git a/src/app/config/configcommandexecutor.cpp b/src/app/config/configcommandexecutor.cpp
index f06e62d3d..14e5bd6ab 100644
--- a/src/app/config/configcommandexecutor.cpp
+++ b/src/app/config/configcommandexecutor.cpp
@@ -138,8 +138,8 @@ void ConfigCommandExecutor::importSettings(const QString &filename)
stream.setCodec("UTF-8");
while (!stream.atEnd()) {
QString line = stream.readLine();
- int colon = line.indexOf(':');
- if (colon >= 0 && !line.startsWith("#")) {
+ int colon = line.indexOf(QLatin1Char(':'));
+ if (colon >= 0 && !line.startsWith(QLatin1Char('#'))) {
const QString key = line.left(colon).trimmed();
const QString value = line.mid(colon + 1).trimmed();
m_settings->setValue(key, value);
diff --git a/src/app/config/configcommandlineparser.cpp b/src/app/config/configcommandlineparser.cpp
index 0b99b09fc..a25e75d8b 100644
--- a/src/app/config/configcommandlineparser.cpp
+++ b/src/app/config/configcommandlineparser.cpp
@@ -50,18 +50,18 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine)
return;
}
- while (!args.isEmpty() && args.first().startsWith("--")) {
+ while (!args.isEmpty() && args.first().startsWith(QLatin1String("--"))) {
const QString arg = args.takeFirst().mid(2);
- if (arg == "list")
+ if (arg == QLatin1String("list"))
setCommand(ConfigCommand::CfgList);
- else if (arg == "unset")
+ else if (arg == QLatin1String("unset"))
setCommand(ConfigCommand::CfgUnset);
- else if (arg == "export")
+ else if (arg == QLatin1String("export"))
setCommand(ConfigCommand::CfgExport);
- else if (arg == "import")
+ else if (arg == QLatin1String("import"))
setCommand(ConfigCommand::CfgImport);
else
- throw ErrorInfo("Unknown option for config command.");
+ throw ErrorInfo(Tr::tr("Unknown option for config command."));
}
switch (command().command) {
@@ -69,7 +69,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine)
if (args.isEmpty())
throw ErrorInfo(Tr::tr("No parameters supplied."));
if (args.count() > 2)
- throw ErrorInfo("Too many arguments.");
+ throw ErrorInfo(Tr::tr("Too many arguments."));
m_command.varNames << args.first();
if (args.count() == 1) {
setCommand(ConfigCommand::CfgGet);
@@ -80,17 +80,17 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine)
break;
case ConfigCommand::CfgUnset:
if (args.isEmpty())
- throw ErrorInfo("Need name of variable to unset.");
+ throw ErrorInfo(Tr::tr("Need name of variable to unset."));
m_command.varNames = args;
break;
case ConfigCommand::CfgExport:
if (args.count() != 1)
- throw ErrorInfo("Need name of file to which to export.");
+ throw ErrorInfo(Tr::tr("Need name of file to which to export."));
m_command.fileName = args.first();
break;
case ConfigCommand::CfgImport:
if (args.count() != 1)
- throw ErrorInfo("Need name of file from which to import.");
+ throw ErrorInfo(Tr::tr("Need name of file from which to import."));
m_command.fileName = args.first();
break;
case ConfigCommand::CfgList:
@@ -104,7 +104,7 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine)
void ConfigCommandLineParser::setCommand(ConfigCommand::Command command)
{
if (m_command.command != ConfigCommand::CfgNone)
- throw ErrorInfo("You cannot specify more than one command.");
+ throw ErrorInfo(Tr::tr("You cannot specify more than one command."));
m_command.command = command;
}
diff --git a/src/app/detect-toolchains/msvcprobe.cpp b/src/app/detect-toolchains/msvcprobe.cpp
index 707c86cc7..fe2ac9bfd 100644
--- a/src/app/detect-toolchains/msvcprobe.cpp
+++ b/src/app/detect-toolchains/msvcprobe.cpp
@@ -73,16 +73,18 @@ static void addMSVCPlatform(const MSVC &msvc, Settings *settings, QList<Profile>
qbsInfo() << Tr::tr("Setting up profile '%1'.").arg(name);
Profile p(name, settings);
p.removeProfile();
- p.setValue("qbs.targetOS", QStringList("windows"));
- p.setValue("cpp.toolchainInstallPath", installPath);
- p.setValue("qbs.toolchain", QStringList("msvc"));
- p.setValue("cpp.windowsSDKPath", winSDKPath);
- p.setValue("qbs.architecture", Internal::HostOsInfo::canonicalArchitecture(architecture));
- p.setValue("qbs.endianness", Internal::HostOsInfo::defaultEndianness(architecture));
+ p.setValue(QLatin1String("qbs.targetOS"), QStringList(QLatin1String("windows")));
+ p.setValue(QLatin1String("cpp.toolchainInstallPath"), installPath);
+ p.setValue(QLatin1String("qbs.toolchain"), QStringList(QLatin1String("msvc")));
+ p.setValue(QLatin1String("cpp.windowsSDKPath"), winSDKPath);
+ p.setValue(QLatin1String("qbs.architecture"),
+ Internal::HostOsInfo::canonicalArchitecture(architecture));
+ p.setValue(QLatin1String("qbs.endianness"),
+ Internal::HostOsInfo::defaultEndianness(architecture));
if (msvc.version.toInt() >= 2013) {
const QStringList flags(QLatin1String("/FS"));
- p.setValue("cpp.platformCFlags", flags);
- p.setValue("cpp.platformCxxFlags", flags);
+ p.setValue(QLatin1String("cpp.platformCFlags"), flags);
+ p.setValue(QLatin1String("cpp.platformCxxFlags"), flags);
}
profiles << p;
}
diff --git a/src/app/detect-toolchains/probe.cpp b/src/app/detect-toolchains/probe.cpp
index 58cc620db..18d1eba89 100644
--- a/src/app/detect-toolchains/probe.cpp
+++ b/src/app/detect-toolchains/probe.cpp
@@ -73,15 +73,15 @@ static void specific_probe(Settings *settings, QList<Profile> &profiles, QString
QString toolchainType;
QStringList toolchainTypes;
- if (cc.contains("clang")) {
- toolchainType = "clang";
- toolchainTypes << "clang" << "llvm" << "gcc";
- } else if (cc.contains("llvm")) {
- toolchainType = "llvm-gcc";
- toolchainTypes << "llvm" << "gcc";
- } else if (cc.contains("gcc")) {
- toolchainType = "gcc";
- toolchainTypes << "gcc";
+ if (cc.contains(QLatin1String("clang"))) {
+ toolchainType = QLatin1String("clang");
+ toolchainTypes << QLatin1String("clang") << QLatin1String("llvm") << QLatin1String("gcc");
+ } else if (cc.contains(QLatin1String("llvm"))) {
+ toolchainType = QLatin1String("llvm-gcc");
+ toolchainTypes << QLatin1String("llvm") << QLatin1String("gcc");
+ } else if (cc.contains(QLatin1String("gcc"))) {
+ toolchainType = QLatin1String("gcc");
+ toolchainTypes << QLatin1String("gcc");
}
QString path = QString::fromLocal8Bit(qgetenv("PATH"));
@@ -92,16 +92,16 @@ static void specific_probe(Settings *settings, QList<Profile> &profiles, QString
QString pathToGcc;
if (ld.isEmpty())
- ld = "ld";
+ ld = QLatin1String("ld");
if (cxx.isEmpty()) {
- if (toolchainType == "gcc")
- cxx = "g++";
- else if (toolchainType == "llvm-gcc")
- cxx = "llvm-g++";
- else if (toolchainType == "clang")
- cxx = "clang++";
+ if (toolchainType == QLatin1String("gcc"))
+ cxx = QLatin1String("g++");
+ else if (toolchainType == QLatin1String("llvm-gcc"))
+ cxx = QLatin1String("llvm-g++");
+ else if (toolchainType == QLatin1String("clang"))
+ cxx = QLatin1String("clang++");
}
- if(!cross.isEmpty() && !cc.startsWith("/")) {
+ if (!cross.isEmpty() && !cc.startsWith(QLatin1Char('/'))) {
pathToGcc = searchPath(path, cross + cc);
if (QFileInfo(pathToGcc).exists()) {
if (!cc.contains(cross))
@@ -112,7 +112,7 @@ static void specific_probe(Settings *settings, QList<Profile> &profiles, QString
ld.prepend(cross);
}
}
- if (cc.startsWith("/"))
+ if (cc.startsWith(QLatin1Char('/')))
pathToGcc = cc;
else
pathToGcc = searchPath(path, cc);
@@ -122,8 +122,9 @@ static void specific_probe(Settings *settings, QList<Profile> &profiles, QString
return;
}
- QString compilerTriplet = qsystem(pathToGcc, QStringList() << "-dumpmachine").simplified();
- QStringList compilerTripletl = compilerTriplet.split('-');
+ QString compilerTriplet = qsystem(pathToGcc, QStringList()
+ << QLatin1String("-dumpmachine")).simplified();
+ QStringList compilerTripletl = compilerTriplet.split(QLatin1Char('-'));
if (compilerTripletl.count() < 2) {
qbsError() << QString::fromLocal8Bit("Detected '%1', but I don't understand "
"its architecture '%2'.").arg(pathToGcc, compilerTriplet);
@@ -132,7 +133,7 @@ static void specific_probe(Settings *settings, QList<Profile> &profiles, QString
const QString architecture = compilerTripletl.at(0);
- QStringList pathToGccL = pathToGcc.split('/');
+ QStringList pathToGccL = pathToGcc.split(QLatin1Char('/'));
QString compilerName = pathToGccL.takeLast().replace(cc, cxx);
qbsInfo() << Tr::tr("Toolchain detected:\n"
@@ -148,18 +149,22 @@ static void specific_probe(Settings *settings, QList<Profile> &profiles, QString
Profile profile(toolchainType, settings);
profile.removeProfile();
- profile.setValue("qbs.toolchain", toolchainTypes);
- profile.setValue("qbs.architecture", HostOsInfo::canonicalArchitecture(architecture));
- profile.setValue("qbs.endianness", HostOsInfo::defaultEndianness(architecture));
+ profile.setValue(QLatin1String("qbs.toolchain"), toolchainTypes);
+ profile.setValue(QLatin1String("qbs.architecture"),
+ HostOsInfo::canonicalArchitecture(architecture));
+ profile.setValue(QLatin1String("qbs.endianness"),
+ HostOsInfo::defaultEndianness(architecture));
- if (compilerName.contains('-')) {
- QStringList nl = compilerName.split('-');
- profile.setValue("cpp.compilerName", nl.takeLast());
- profile.setValue("cpp.toolchainPrefix", nl.join("-") + '-');
+ if (compilerName.contains(QLatin1Char('-'))) {
+ QStringList nl = compilerName.split(QLatin1Char('-'));
+ profile.setValue(QLatin1String("cpp.compilerName"), nl.takeLast());
+ profile.setValue(QLatin1String("cpp.toolchainPrefix"),
+ nl.join(QLatin1String("-")) + QLatin1Char('-'));
} else {
- profile.setValue("cpp.compilerName", compilerName);
+ profile.setValue(QLatin1String("cpp.compilerName"), compilerName);
}
- profile.setValue("cpp.toolchainInstallPath", pathToGccL.join("/"));
+ profile.setValue(QLatin1String("cpp.toolchainInstallPath"),
+ pathToGccL.join(QLatin1String("/")));
profiles << profile;
}
@@ -170,9 +175,10 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles)
QString gccPath;
QByteArray envPath = qgetenv("PATH");
foreach (const QByteArray &dir, envPath.split(';')) {
- QFileInfo fi(dir + "/gcc.exe");
+ QFileInfo fi(QString::fromLocal8Bit(dir) + QLatin1String("/gcc.exe"));
if (fi.exists()) {
- mingwPath = QFileInfo(dir + "/..").canonicalFilePath();
+ mingwPath = QFileInfo(QString::fromLocal8Bit(dir)
+ + QLatin1String("/..")).canonicalFilePath();
gccPath = fi.absoluteFilePath();
mingwBinPath = fi.absolutePath();
break;
@@ -181,7 +187,7 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles)
if (gccPath.isEmpty())
return;
QProcess process;
- process.start(gccPath, QStringList() << "-dumpmachine");
+ process.start(gccPath, QStringList() << QLatin1String("-dumpmachine"));
if (!process.waitForStarted()) {
qbsError() << "Could not start \"gcc -dumpmachine\".";
return;
@@ -189,8 +195,9 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles)
process.waitForFinished(-1);
QByteArray gccMachineName = process.readAll().trimmed();
QStringList validMinGWMachines;
- validMinGWMachines << "mingw32" << "mingw64" << "i686-w64-mingw32" << "x86_64-w64-mingw32";
- if (!validMinGWMachines.contains(gccMachineName)) {
+ validMinGWMachines << QLatin1String("mingw32") << QLatin1String("mingw64")
+ << QLatin1String("i686-w64-mingw32") << QLatin1String("x86_64-w64-mingw32");
+ if (!validMinGWMachines.contains(QString::fromLocal8Bit(gccMachineName))) {
qbsError() << QString::fromLocal8Bit("Detected gcc platform '%1' is not supported.")
.arg(QString::fromLocal8Bit(gccMachineName));
return;
@@ -204,10 +211,11 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles)
Profile profile(QString::fromLocal8Bit(gccMachineName), settings);
qbsInfo() << Tr::tr("Platform '%1' detected in '%2'.").arg(profile.name(), mingwPath);
- profile.setValue("qbs.targetOS", QStringList("windows"));
- profile.setValue("cpp.toolchainInstallPath", mingwBinPath);
- profile.setValue("cpp.compilerName", QLatin1String("g++.exe"));
- profile.setValue("qbs.toolchain", QStringList() << "mingw" << "gcc");
+ profile.setValue(QLatin1String("qbs.targetOS"), QStringList(QLatin1String("windows")));
+ profile.setValue(QLatin1String("cpp.toolchainInstallPath"), mingwBinPath);
+ profile.setValue(QLatin1String("cpp.compilerName"), QLatin1String("g++.exe"));
+ profile.setValue(QLatin1String("qbs.toolchain"), QStringList() << QLatin1String("mingw")
+ << QLatin1String("gcc"));
profile.setValue(QLatin1String("qbs.architecture"),
HostOsInfo::canonicalArchitecture(QString::fromLatin1(architecture)));
profile.setValue(QLatin1String("qbs.endianness"),
diff --git a/src/app/detect-toolchains/xcodeprobe.cpp b/src/app/detect-toolchains/xcodeprobe.cpp
index 30d5a56a0..89533528b 100644
--- a/src/app/detect-toolchains/xcodeprobe.cpp
+++ b/src/app/detect-toolchains/xcodeprobe.cpp
@@ -121,7 +121,7 @@ bool XcodeProbe::addDeveloperPath(const QString &path)
void XcodeProbe::detectDeveloperPaths()
{
QProcess selectedXcode;
- QString program = "/usr/bin/xcode-select";
+ QString program = QLatin1String("/usr/bin/xcode-select");
QStringList arguments(QLatin1String("--print-path"));
selectedXcode.start(program, arguments, QProcess::ReadOnly);
if (!selectedXcode.waitForFinished() || selectedXcode.exitCode()) {
@@ -136,15 +136,15 @@ void XcodeProbe::detectDeveloperPaths()
void XcodeProbe::setArch(Profile *profile, const QString &pathToGcc, const QStringList &extraFlags)
{
if (!extraFlags.isEmpty()) {
- profile->setValue("cpp.platformCommonCompilerFlags", extraFlags);
- profile->setValue("cpp.platformLinkerFlags", extraFlags);
+ profile->setValue(QLatin1String("cpp.platformCommonCompilerFlags"), extraFlags);
+ profile->setValue(QLatin1String("cpp.platformLinkerFlags"), extraFlags);
}
// setting architecture and endianness only here, bercause the same compiler
// can support several ones
QStringList flags(extraFlags);
flags << QLatin1String("-dumpmachine");
QString compilerTriplet = qsystem(pathToGcc, flags).simplified();
- QStringList compilerTripletl = compilerTriplet.split('-');
+ QStringList compilerTripletl = compilerTriplet.split(QLatin1Char('-'));
if (compilerTripletl.count() < 2) {
qbsError() << QString::fromLocal8Bit("Detected '%1', but I don't understand "
"its architecture '%2'.")
@@ -160,8 +160,10 @@ void XcodeProbe::setArch(Profile *profile, const QString &pathToGcc, const QStri
" arch: %4").arg(profile->name(), pathToGcc, compilerTriplet,
architecture);
- profile->setValue("qbs.endianness", HostOsInfo::defaultEndianness(architecture));
- profile->setValue("qbs.architecture", HostOsInfo::canonicalArchitecture(architecture));
+ profile->setValue(QLatin1String("qbs.endianness"),
+ HostOsInfo::defaultEndianness(architecture));
+ profile->setValue(QLatin1String("qbs.architecture"),
+ HostOsInfo::canonicalArchitecture(architecture));
}
void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &xCodeName)
@@ -263,7 +265,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x
+ QLatin1String("-clang"), settings);
pSdk.removeProfile();
pSdk.setBaseProfile(clangFullName);
- pSdk.setValue("qbs.sysroot", sdkDirInfo.canonicalFilePath());
+ pSdk.setValue(QLatin1String("qbs.sysroot"), sdkDirInfo.canonicalFilePath());
qbsInfo() << indent << Tr::tr("* adding profile %1").arg(pSdk.name());
profiles << pSdk;
}
@@ -272,7 +274,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x
+ QLatin1String("-gcc"), settings);
pSdk.removeProfile();
pSdk.setBaseProfile(gccFullName);
- pSdk.setValue("qbs.sysroot", sdkDirInfo.canonicalFilePath());
+ pSdk.setValue(QLatin1String("qbs.sysroot"), sdkDirInfo.canonicalFilePath());
qbsInfo() << indent << Tr::tr("* adding profile %1").arg(pSdk.name());
profiles << pSdk;
}
@@ -285,8 +287,11 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x
if (hasClang) {
Profile clangProfile(clangFullName, settings);
clangProfile.removeProfile();
- clangProfile.setValue("qbs.targetOS", targetOS);
- clangProfile.setValue("qbs.toolchain", QStringList() << "clang" << "llvm" << "gcc");
+ clangProfile.setValue(QLatin1String("qbs.targetOS"), targetOS);
+ clangProfile.setValue(QLatin1String("qbs.toolchain"),
+ QStringList() << QLatin1String("clang")
+ << QLatin1String("llvm")
+ << QLatin1String("gcc"));
QStringList extraFlags;
if (defaultProp.contains(QLatin1String("ARCHS"))) {
QString arch = defaultProp.value(QLatin1String("ARCHS")).toString();
@@ -294,16 +299,17 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x
extraFlags << QLatin1String("-arch") << QLatin1String("i386");
}
if (defaultProp.contains(QLatin1String("NATIVE_ARCH"))) {
- QString arch = defaultProp.value("NATIVE_ARCH").toString();
+ QString arch = defaultProp.value(QLatin1String("NATIVE_ARCH")).toString();
if (!arch.startsWith(QLatin1String("arm")))
qbsInfo() << indent << Tr::tr("Expected arm architecture, not %1").arg(arch);
extraFlags << QLatin1String("-arch") << arch;
}
if (!sysRoot.isEmpty())
- clangProfile.setValue("qbs.sysroot", sysRoot);
- clangProfile.setValue("cpp.platformPath", fInfo.canonicalFilePath());
- clangProfile.setValue("cpp.compilerName", clangFileInfo.fileName());
- clangProfile.setValue("cpp.toolchainInstallPath", clangFileInfo.canonicalPath());
+ clangProfile.setValue(QLatin1String("qbs.sysroot"), sysRoot);
+ clangProfile.setValue(QLatin1String("cpp.platformPath"), fInfo.canonicalFilePath());
+ clangProfile.setValue(QLatin1String("cpp.compilerName"), clangFileInfo.fileName());
+ clangProfile.setValue(QLatin1String("cpp.toolchainInstallPath"),
+ clangFileInfo.canonicalPath());
setArch(&clangProfile, clangFileInfo.canonicalFilePath(), extraFlags);
qbsInfo() << indent << Tr::tr("* adding profile %1").arg(clangProfile.name());
profiles << clangProfile;
@@ -312,17 +318,18 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x
Profile gccProfile(gccFullName, settings);
gccProfile.removeProfile();
// use the arm-apple-darwin10-llvm-* variant if available???
- gccProfile.setValue("qbs.targetOS", targetOS);
+ gccProfile.setValue(QLatin1String("qbs.targetOS"), targetOS);
QStringList toolchainTypes;
- toolchainTypes << "gcc";
- if (gccFullName.contains("llvm"))
- toolchainTypes << "llvm";
- gccProfile.setValue("qbs.toolchain", toolchainTypes);
+ toolchainTypes << QLatin1String("gcc");
+ if (gccFullName.contains(QLatin1String("llvm")))
+ toolchainTypes << QLatin1String("llvm");
+ gccProfile.setValue(QLatin1String("qbs.toolchain"), toolchainTypes);
if (!sysRoot.isEmpty())
- gccProfile.setValue("qbs.sysroot", sysRoot);
- gccProfile.setValue("cpp.platformPath",fInfo.canonicalFilePath());
- gccProfile.setValue("cpp.compilerName", gccFileInfo.fileName());
- gccProfile.setValue("cpp.toolchainInstallPath", gccFileInfo.canonicalPath());
+ gccProfile.setValue(QLatin1String("qbs.sysroot"), sysRoot);
+ gccProfile.setValue(QLatin1String("cpp.platformPath"),fInfo.canonicalFilePath());
+ gccProfile.setValue(QLatin1String("cpp.compilerName"), gccFileInfo.fileName());
+ gccProfile.setValue(QLatin1String("cpp.toolchainInstallPath"),
+ gccFileInfo.canonicalPath());
setArch(&gccProfile, gccFileInfo.canonicalFilePath(), QStringList());
qbsInfo() << indent << Tr::tr("* adding profile %1").arg(gccProfile.name());
profiles << gccProfile;
diff --git a/src/app/qbs-setup-qt/main.cpp b/src/app/qbs-setup-qt/main.cpp
index 54fa6739a..34adcb3e2 100644
--- a/src/app/qbs-setup-qt/main.cpp
+++ b/src/app/qbs-setup-qt/main.cpp
@@ -80,7 +80,8 @@ int main(int argc, char *argv[])
foreach (const QtEnvironment &qtEnvironment, qtEnvironments) {
QString profileName = QLatin1String("qt-") + qtEnvironment.qtVersion;
if (SetupQt::checkIfMoreThanOneQtWithTheSameVersion(qtEnvironment.qtVersion, qtEnvironments)) {
- QStringList prefixPathParts = qtEnvironment.installPrefixPath.split("/", QString::SkipEmptyParts);
+ QStringList prefixPathParts = qtEnvironment.installPrefixPath
+ .split(QLatin1Char('/'), QString::SkipEmptyParts);
if (!prefixPathParts.isEmpty())
profileName += QLatin1String("-") + prefixPathParts.last();
}
@@ -96,7 +97,7 @@ int main(int argc, char *argv[])
}
QtEnvironment qtEnvironment = SetupQt::fetchEnvironment(qmakePath);
QString profileName = QLatin1String("qt-") + qtEnvironment.qtVersion;
- profileName.replace(".", "-");
+ profileName.replace(QLatin1Char('.'), QLatin1Char('-'));
SetupQt::saveToQbsSettings(profileName , qtEnvironment, settings.data());
return EXIT_SUCCESS;
}
@@ -108,7 +109,7 @@ int main(int argc, char *argv[])
}
QtEnvironment qtEnvironment = SetupQt::fetchEnvironment(qmakePath);
QString profileName = args.at(1);
- profileName.replace(".", "-");
+ profileName.replace(QLatin1Char('.'), QLatin1Char('-'));
SetupQt::saveToQbsSettings(profileName , qtEnvironment, settings.data());
return EXIT_SUCCESS;
}
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index 1ee3cb8b2..0d180ae5e 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -101,7 +101,7 @@ QList<QtEnvironment> SetupQt::fetchEnvironments()
static QMap<QByteArray, QByteArray> qmakeQueryOutput(const QString &qmakePath)
{
QProcess qmakeProcess;
- qmakeProcess.start(qmakePath, QStringList() << "-query");
+ qmakeProcess.start(qmakePath, QStringList() << QLatin1String("-query"));
if (!qmakeProcess.waitForStarted())
throw ErrorInfo(SetupQt::tr("%1 cannot be started.").arg(qmakePath));
qmakeProcess.waitForFinished();
@@ -135,7 +135,7 @@ static QString configVariable(const QByteArray &configContent, const QString &ke
bool success = false;
foreach (const QByteArray &configContentLine, configContentLines) {
- success = regexp.exactMatch(configContentLine);
+ success = regexp.exactMatch(QString::fromLocal8Bit(configContentLine));
if (success)
break;
}
@@ -154,7 +154,7 @@ static QStringList configVariableItems(const QByteArray &configContent, const QS
static Version extractVersion(const QString &versionString)
{
Version v;
- const QStringList parts = versionString.split('.', QString::SkipEmptyParts);
+ const QStringList parts = versionString.split(QLatin1Char('.'), QString::SkipEmptyParts);
const QList<int *> vparts = QList<int *>() << &v.majorVersion << &v.minorVersion << &v.patchLevel;
const int c = qMin(parts.count(), vparts.count());
for (int i = 0; i < c; ++i)
@@ -167,15 +167,16 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
QtEnvironment qtEnvironment;
QMap<QByteArray, QByteArray> queryOutput = qmakeQueryOutput(qmakePath);
- qtEnvironment.installPrefixPath = queryOutput.value("QT_INSTALL_PREFIX");
- qtEnvironment.documentationPath = queryOutput.value("QT_INSTALL_DOCS");
- qtEnvironment.includePath = queryOutput.value("QT_INSTALL_HEADERS");
- qtEnvironment.libraryPath = queryOutput.value("QT_INSTALL_LIBS");
- qtEnvironment.binaryPath = queryOutput.value("QT_INSTALL_BINS");
- qtEnvironment.documentationPath = queryOutput.value("QT_INSTALL_DOCS");
- qtEnvironment.pluginPath = queryOutput.value("QT_INSTALL_PLUGINS");
- qtEnvironment.qmlImportPath = queryOutput.value("QT_INSTALL_IMPORTS");
- qtEnvironment.qtVersion = queryOutput.value("QT_VERSION");
+ qtEnvironment.installPrefixPath =
+ QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_PREFIX"));
+ qtEnvironment.documentationPath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_DOCS"));
+ qtEnvironment.includePath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_HEADERS"));
+ qtEnvironment.libraryPath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_LIBS"));
+ qtEnvironment.binaryPath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_BINS"));
+ qtEnvironment.documentationPath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_DOCS"));
+ qtEnvironment.pluginPath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_PLUGINS"));
+ qtEnvironment.qmlImportPath = QString::fromLocal8Bit(queryOutput.value("QT_INSTALL_IMPORTS"));
+ qtEnvironment.qtVersion = QString::fromLocal8Bit(queryOutput.value("QT_VERSION"));
const Version qtVersion = extractVersion(qtEnvironment.qtVersion);
@@ -188,18 +189,22 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
mkspecsBasePath = queryOutput.value("QT_INSTALL_DATA") + "/mkspecs";
}
- if (!QFile::exists(mkspecsBasePath))
+ if (!QFile::exists(QString::fromLocal8Bit(mkspecsBasePath)))
throw ErrorInfo(tr("Cannot extract the mkspecs directory."));
- const QByteArray qconfigContent = readFileContent(mkspecsBasePath + "/qconfig.pri");
- qtEnvironment.qtMajorVersion = configVariable(qconfigContent, "QT_MAJOR_VERSION").toInt();
- qtEnvironment.qtMinorVersion = configVariable(qconfigContent, "QT_MINOR_VERSION").toInt();
- qtEnvironment.qtPatchVersion = configVariable(qconfigContent, "QT_PATCH_VERSION").toInt();
- qtEnvironment.qtNameSpace = configVariable(qconfigContent, "QT_NAMESPACE");
- qtEnvironment.qtLibInfix = configVariable(qconfigContent, "QT_LIBINFIX");
- qtEnvironment.architecture = configVariable(qconfigContent, "QT_TARGET_ARCH");
+ const QByteArray qconfigContent = readFileContent(QString::fromLocal8Bit(mkspecsBasePath)
+ + QLatin1String("/qconfig.pri"));
+ qtEnvironment.qtMajorVersion = configVariable(qconfigContent,
+ QLatin1String("QT_MAJOR_VERSION")).toInt();
+ qtEnvironment.qtMinorVersion = configVariable(qconfigContent,
+ QLatin1String("QT_MINOR_VERSION")).toInt();
+ qtEnvironment.qtPatchVersion = configVariable(qconfigContent,
+ QLatin1String("QT_PATCH_VERSION")).toInt();
+ qtEnvironment.qtNameSpace = configVariable(qconfigContent, QLatin1String("QT_NAMESPACE"));
+ qtEnvironment.qtLibInfix = configVariable(qconfigContent, QLatin1String("QT_LIBINFIX"));
+ qtEnvironment.architecture = configVariable(qconfigContent, QLatin1String("QT_TARGET_ARCH"));
if (qtEnvironment.architecture.isEmpty())
- qtEnvironment.architecture = configVariable(qconfigContent, "QT_ARCH");
+ qtEnvironment.architecture = configVariable(qconfigContent, QLatin1String("QT_ARCH"));
if (qtEnvironment.architecture.isEmpty())
qtEnvironment.architecture = QLatin1String("x86");
qtEnvironment.configItems = configVariableItems(qconfigContent, QLatin1String("CONFIG"));
@@ -207,17 +212,22 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
// retrieve the mkspec
if (qtVersion.majorVersion >= 5) {
- const QString mkspecName = queryOutput.value("QMAKE_XSPEC");
+ const QString mkspecName = QString::fromLocal8Bit(queryOutput.value("QMAKE_XSPEC"));
qtEnvironment.mkspecName = mkspecName;
- qtEnvironment.mkspecPath = mkspecsBasePath + QLatin1Char('/') + mkspecName;
+ qtEnvironment.mkspecPath = QString::fromLocal8Bit(mkspecsBasePath)
+ + QLatin1Char('/') + mkspecName;
if (!mkspecsBaseSrcPath.isEmpty() && !QFile::exists(qtEnvironment.mkspecPath))
- qtEnvironment.mkspecPath = mkspecsBaseSrcPath + QLatin1Char('/') + mkspecName;
+ qtEnvironment.mkspecPath = QString::fromLocal8Bit(mkspecsBaseSrcPath)
+ + QLatin1Char('/') + mkspecName;
} else {
if (HostOsInfo::isWindowsHost()) {
- const QByteArray fileContent = readFileContent(mkspecsBasePath + "/default/qmake.conf");
- qtEnvironment.mkspecPath = configVariable(fileContent, "QMAKESPEC_ORIGINAL");
+ const QByteArray fileContent = readFileContent(QString::fromLocal8Bit(mkspecsBasePath)
+ + QLatin1String("/default/qmake.conf"));
+ qtEnvironment.mkspecPath = configVariable(fileContent,
+ QLatin1String("QMAKESPEC_ORIGINAL"));
} else {
- qtEnvironment.mkspecPath = QFileInfo(mkspecsBasePath + "/default").symLinkTarget();
+ qtEnvironment.mkspecPath = QFileInfo(QString::fromLocal8Bit(mkspecsBasePath)
+ + QLatin1String("/default")).symLinkTarget();
}
qtEnvironment.mkspecName = qtEnvironment.mkspecPath;
int idx = qtEnvironment.mkspecName.lastIndexOf(QLatin1Char('/'));
@@ -227,10 +237,10 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
// determine whether we have a framework build
qtEnvironment.frameworkBuild = false;
- if (qtEnvironment.mkspecPath.contains("macx")) {
- if (qtEnvironment.configItems.contains("qt_framework"))
+ if (qtEnvironment.mkspecPath.contains(QLatin1String("macx"))) {
+ if (qtEnvironment.configItems.contains(QLatin1String("qt_framework")))
qtEnvironment.frameworkBuild = true;
- else if (!qtEnvironment.configItems.contains("qt_no_framework"))
+ else if (!qtEnvironment.configItems.contains(QLatin1String("qt_no_framework")))
throw ErrorInfo(tr("could not determine whether Qt is a frameworks build"));
}
@@ -258,11 +268,11 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
}
// determine whether Qt is built with debug, release or both
- if (qtEnvironment.qtConfigItems.contains("debug_and_release")) {
+ if (qtEnvironment.qtConfigItems.contains(QLatin1String("debug_and_release"))) {
qtEnvironment.buildVariant << QLatin1String("debug") << QLatin1String("release");
} else {
- int idxDebug = qtEnvironment.qtConfigItems.indexOf("debug");
- int idxRelease = qtEnvironment.qtConfigItems.indexOf("release");
+ int idxDebug = qtEnvironment.qtConfigItems.indexOf(QLatin1String("debug"));
+ int idxRelease = qtEnvironment.qtConfigItems.indexOf(QLatin1String("release"));
if (idxDebug < idxRelease)
qtEnvironment.buildVariant << QLatin1String("release");
else
@@ -270,8 +280,8 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
}
// determine whether user apps require C++11
- if (qtEnvironment.qtConfigItems.contains("c++11") && qtEnvironment.staticBuild)
- qtEnvironment.configItems.append("c++11");
+ if (qtEnvironment.qtConfigItems.contains(QLatin1String("c++11")) && qtEnvironment.staticBuild)
+ qtEnvironment.configItems.append(QLatin1String("c++11"));
if (!QFileInfo(qtEnvironment.mkspecPath).exists())
throw ErrorInfo(tr("mkspec '%1' does not exist").arg(qtEnvironment.mkspecPath));
diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp
index 69f56e7dd..54d3cddf8 100644
--- a/src/app/qbs/parser/commandlineparser.cpp
+++ b/src/app/qbs/parser/commandlineparser.cpp
@@ -408,7 +408,7 @@ QString CommandLineParser::CommandLineParserPrivate::generalHelp() const
QStringList toolNames = QbsTool::allToolNames();
toolNames.sort();
if (!toolNames.isEmpty()) {
- help.append('\n').append(Tr::tr("Auxiliary commands:\n"));
+ help.append(QLatin1Char('\n')).append(Tr::tr("Auxiliary commands:\n"));
foreach (const QString &toolName, toolNames) {
help.append(QLatin1String(" ")).append(toolName);
const QString whitespace = QString(rhsIndentation - 2 - toolName.count(),
@@ -550,10 +550,10 @@ void CommandLineParser::CommandLineParserPrivate::setupLogLevel()
QString CommandLineParser::CommandLineParserPrivate::propertyName(const QString &aCommandLineName) const
{
// Make fully-qualified, ie "platform" -> "qbs.platform"
- if (aCommandLineName.contains("."))
+ if (aCommandLineName.contains(QLatin1Char('.')))
return aCommandLineName;
else
- return "qbs." + aCommandLineName;
+ return QLatin1String("qbs.") + aCommandLineName;
}
} // namespace qbs
diff --git a/src/app/qbs/status.cpp b/src/app/qbs/status.cpp
index 60358ea22..66f980bd2 100644
--- a/src/app/qbs/status.cpp
+++ b/src/app/qbs/status.cpp
@@ -44,21 +44,29 @@ namespace qbs {
static QList<QRegExp> createIgnoreList(const QString &projectRootPath)
{
QList<QRegExp> ignoreRegularExpressionList;
- ignoreRegularExpressionList.append(QRegExp(projectRootPath + "/build.*"));
- ignoreRegularExpressionList.append(QRegExp("*.qbs", Qt::CaseSensitive, QRegExp::Wildcard));
- ignoreRegularExpressionList.append(QRegExp("*.pro", Qt::CaseSensitive, QRegExp::Wildcard));
- ignoreRegularExpressionList.append(QRegExp("*Makefile", Qt::CaseSensitive, QRegExp::Wildcard));
- ignoreRegularExpressionList.append(QRegExp("*.so*", Qt::CaseSensitive, QRegExp::Wildcard));
- ignoreRegularExpressionList.append(QRegExp("*.o", Qt::CaseSensitive, QRegExp::Wildcard));
- QString ignoreFilePath = projectRootPath + "/.qbsignore";
+ ignoreRegularExpressionList.append(QRegExp(projectRootPath + QLatin1String("/build.*")));
+ ignoreRegularExpressionList.append(QRegExp(QLatin1String("*.qbs"),
+ Qt::CaseSensitive, QRegExp::Wildcard));
+ ignoreRegularExpressionList.append(QRegExp(QLatin1String("*.pro"),
+ Qt::CaseSensitive, QRegExp::Wildcard));
+ ignoreRegularExpressionList.append(QRegExp(QLatin1String("*Makefile"),
+ Qt::CaseSensitive, QRegExp::Wildcard));
+ ignoreRegularExpressionList.append(QRegExp(QLatin1String("*.so*"),
+ Qt::CaseSensitive, QRegExp::Wildcard));
+ ignoreRegularExpressionList.append(QRegExp(QLatin1String("*.o"),
+ Qt::CaseSensitive, QRegExp::Wildcard));
+ QString ignoreFilePath = projectRootPath + QLatin1String("/.qbsignore");
QFile ignoreFile(ignoreFilePath);
if (ignoreFile.open(QFile::ReadOnly)) {
QList<QByteArray> ignoreTokenList = ignoreFile.readAll().split('\n');
- foreach (const QString &token, ignoreTokenList) {
- if (token.left(1) == "/")
- ignoreRegularExpressionList.append(QRegExp(projectRootPath + token + ".*", Qt::CaseSensitive, QRegExp::RegExp2));
+ foreach (const QByteArray &btoken, ignoreTokenList) {
+ const QString token = QString::fromLatin1(btoken);
+ if (token.left(1) == QLatin1String("/"))
+ ignoreRegularExpressionList.append(QRegExp(projectRootPath
+ + token + QLatin1String(".*"),
+ Qt::CaseSensitive, QRegExp::RegExp2));
else if (!token.isEmpty())
ignoreRegularExpressionList.append(QRegExp(token, Qt::CaseSensitive, QRegExp::RegExp2));
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp
index 43b5c5605..25ec6ab46 100644
--- a/src/lib/corelib/api/runenvironment.cpp
+++ b/src/lib/corelib/api/runenvironment.cpp
@@ -115,7 +115,7 @@ int RunEnvironment::runShell()
envFile.reset(new QTemporaryFile);
if (envFile->open()) {
if (command.endsWith(QLatin1String("bash")))
- command += " --posix"; // Teach bash some manners.
+ command += QLatin1String(" --posix"); // Teach bash some manners.
const QString promptLine = QLatin1String("PS1='") + prompt + QLatin1String("'\n");
envFile->write(promptLine.toLocal8Bit());
envFile->close();
diff --git a/src/lib/corelib/buildgraph/artifactcleaner.cpp b/src/lib/corelib/buildgraph/artifactcleaner.cpp
index 98fed728e..a1e91cdaf 100644
--- a/src/lib/corelib/buildgraph/artifactcleaner.cpp
+++ b/src/lib/corelib/buildgraph/artifactcleaner.cpp
@@ -166,7 +166,7 @@ void ArtifactCleaner::cleanup(const TopLevelProjectPtr &project,
if (dir.startsWith(project->buildDirectory) && FileInfo(dir).exists())
removeEmptyDirectories(dir, options);
if (dir != project->buildDirectory) {
- const QString parentDir = QDir::cleanPath(dir + "/..");
+ const QString parentDir = QDir::cleanPath(dir + QLatin1String("/.."));
if (parentDir != project->buildDirectory && !dirList.contains(parentDir))
dirList << parentDir;
}
diff --git a/src/lib/corelib/buildgraph/automoc.cpp b/src/lib/corelib/buildgraph/automoc.cpp
index 5dcb6ec9f..38db3b83c 100644
--- a/src/lib/corelib/buildgraph/automoc.cpp
+++ b/src/lib/corelib/buildgraph/automoc.cpp
@@ -59,7 +59,7 @@ void AutoMoc::setScanResultCache(ScanResultCache *scanResultCache)
void AutoMoc::apply(const ResolvedProductPtr &product)
{
if (cppScanners().isEmpty() || hppScanners().isEmpty())
- throw ErrorInfo("C++ scanner cannot be loaded.");
+ throw ErrorInfo(Tr::tr("C++ scanner cannot be loaded."));
Artifact *pluginMetaDataFile = 0;
Artifact *pchFile = 0;
@@ -159,10 +159,11 @@ QString AutoMoc::generateMocFileName(Artifact *artifact, FileType fileType)
case UnknownFileType:
break;
case HppFileType:
- mocFileName = "moc_" + FileInfo::baseName(artifact->filePath()) + ".cpp";
+ mocFileName = QLatin1String("moc_") + FileInfo::baseName(artifact->filePath()) +
+ QLatin1String(".cpp");
break;
case CppFileType:
- mocFileName = FileInfo::baseName(artifact->filePath()) + ".moc";
+ mocFileName = FileInfo::baseName(artifact->filePath()) + QLatin1String(".moc");
break;
}
return mocFileName;
@@ -229,7 +230,8 @@ void AutoMoc::scan(Artifact *artifact, FileType fileType, bool &hasQObjectMacro,
foreach (const ScanResultCache::Dependency &dependency, scanResult.deps) {
const QString &includedFilePath = dependency.filePath();
- if (includedFilePath.startsWith("moc_") && includedFilePath.endsWith(".cpp")) {
+ if (includedFilePath.startsWith(QLatin1String("moc_")) &&
+ includedFilePath.endsWith(QLatin1String(".cpp"))) {
if (m_logger.traceEnabled())
m_logger.qbsTrace() << "[AUTOMOC] finds included file: " << includedFilePath;
includedMocCppFiles += includedFilePath;
diff --git a/src/lib/corelib/buildgraph/buildgraph.cpp b/src/lib/corelib/buildgraph/buildgraph.cpp
index 542d083c9..af723cff7 100644
--- a/src/lib/corelib/buildgraph/buildgraph.cpp
+++ b/src/lib/corelib/buildgraph/buildgraph.cpp
@@ -67,7 +67,8 @@ public:
setProduct(depfunc, product.data());
QScriptValue descriptor = m_engine->newObject();
descriptor.setProperty(QLatin1String("get"), depfunc);
- descriptor.setProperty(QLatin1String("set"), m_engine->evaluate("(function(){})"));
+ descriptor.setProperty(QLatin1String("set"),
+ m_engine->evaluate(QLatin1String("(function(){})")));
descriptor.setProperty(QLatin1String("enumerable"), true);
m_engine->defineProperty(productScriptValue, QLatin1String("dependencies"), descriptor);
}
@@ -124,7 +125,8 @@ private:
depfunc.setData(engine->toScriptValue(propMap.value(QLatin1String("modules"))));
QScriptValue descriptor = engine->newObject();
descriptor.setProperty(QLatin1String("get"), depfunc);
- descriptor.setProperty(QLatin1String("set"), engine->evaluate("(function(){})"));
+ descriptor.setProperty(QLatin1String("set"),
+ engine->evaluate(QLatin1String("(function(){})")));
descriptor.setProperty(QLatin1String("enumerable"), true);
engine->defineProperty(moduleScriptValue, QLatin1String("dependencies"), descriptor);
moduleScriptValue.setProperty(QLatin1String("type"), QLatin1String("module"));
@@ -324,7 +326,7 @@ QString relativeArtifactFileName(const Artifact *artifact)
QString str = artifact->filePath();
if (str.startsWith(buildDir))
str.remove(0, buildDir.count());
- if (str.startsWith('/'))
+ if (str.startsWith(QLatin1Char('/')))
str.remove(0, 1);
return str;
}
@@ -397,12 +399,12 @@ void insertArtifact(const ResolvedProductPtr &product, Artifact *artifact, const
if (lookupArtifact(otherProduct, artifact->filePath())) {
if (artifact->artifactType == Artifact::Generated) {
QString pl;
- pl.append(QString(" - %1 \n").arg(product->name));
+ pl.append(QString::fromLatin1(" - %1 \n").arg(product->name));
foreach (const ResolvedProductConstPtr &p, product->project->products) {
if (lookupArtifact(p, artifact->filePath()))
- pl.append(QString(" - %1 \n").arg(p->name));
+ pl.append(QString::fromLatin1(" - %1 \n").arg(p->name));
}
- throw ErrorInfo(QString ("BUG: already inserted in this project: %1\n%2")
+ throw ErrorInfo(QString::fromLatin1("BUG: already inserted in this project: %1\n%2")
.arg(artifact->filePath()).arg(pl), CodeLocation(), true);
}
}
diff --git a/src/lib/corelib/buildgraph/command.cpp b/src/lib/corelib/buildgraph/command.cpp
index 8e30906ee..60ec93907 100644
--- a/src/lib/corelib/buildgraph/command.cpp
+++ b/src/lib/corelib/buildgraph/command.cpp
@@ -70,9 +70,9 @@ bool AbstractCommand::equals(const AbstractCommand *other) const
void AbstractCommand::fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation)
{
- m_description = scriptValue->property("description").toString();
- m_highlight = scriptValue->property("highlight").toString();
- m_silent = scriptValue->property("silent").toBool();
+ m_description = scriptValue->property(QLatin1String("description")).toString();
+ m_highlight = scriptValue->property(QLatin1String("highlight")).toString();
+ m_silent = scriptValue->property(QLatin1String("silent")).toBool();
m_codeLocation = codeLocation;
}
@@ -90,9 +90,12 @@ static QScriptValue js_CommandBase(QScriptContext *context, QScriptEngine *engin
{
QScriptValue cmd = context->thisObject();
QBS_ASSERT(context->isCalledAsConstructor(), cmd = engine->newObject());
- cmd.setProperty("description", engine->toScriptValue(AbstractCommand::defaultDescription()));
- cmd.setProperty("highlight", engine->toScriptValue(AbstractCommand::defaultHighLight()));
- cmd.setProperty("silent", engine->toScriptValue(AbstractCommand::defaultIsSilent()));
+ cmd.setProperty(QLatin1String("description"),
+ engine->toScriptValue(AbstractCommand::defaultDescription()));
+ cmd.setProperty(QLatin1String("highlight"),
+ engine->toScriptValue(AbstractCommand::defaultHighLight()));
+ cmd.setProperty(QLatin1String("silent"),
+ engine->toScriptValue(AbstractCommand::defaultIsSilent()));
return cmd;
}
@@ -110,16 +113,24 @@ static QScriptValue js_Command(QScriptContext *context, QScriptEngine *engine)
if (arguments.isUndefined())
arguments = engine->toScriptValue(commandPrototype.arguments());
QScriptValue cmd = js_CommandBase(context, engine);
- cmd.setProperty("className", engine->toScriptValue(QString("Command")));
- cmd.setProperty("program", program);
- cmd.setProperty("arguments", arguments);
- cmd.setProperty("workingDir", engine->toScriptValue(commandPrototype.workingDir()));
- cmd.setProperty("maxExitCode", engine->toScriptValue(commandPrototype.maxExitCode()));
- cmd.setProperty("stdoutFilterFunction", engine->toScriptValue(commandPrototype.stdoutFilterFunction()));
- cmd.setProperty("stderrFilterFunction", engine->toScriptValue(commandPrototype.stderrFilterFunction()));
- cmd.setProperty("responseFileThreshold", engine->toScriptValue(commandPrototype.responseFileThreshold()));
- cmd.setProperty("responseFileUsagePrefix", engine->toScriptValue(commandPrototype.responseFileUsagePrefix()));
- cmd.setProperty("environment", engine->toScriptValue(commandPrototype.environment().toStringList()));
+ cmd.setProperty(QLatin1String("className"),
+ engine->toScriptValue(QString::fromLatin1("Command")));
+ cmd.setProperty(QLatin1String("program"), program);
+ cmd.setProperty(QLatin1String("arguments"), arguments);
+ cmd.setProperty(QLatin1String("workingDir"),
+ engine->toScriptValue(commandPrototype.workingDir()));
+ cmd.setProperty(QLatin1String("maxExitCode"),
+ engine->toScriptValue(commandPrototype.maxExitCode()));
+ cmd.setProperty(QLatin1String("stdoutFilterFunction"),
+ engine->toScriptValue(commandPrototype.stdoutFilterFunction()));
+ cmd.setProperty(QLatin1String("stderrFilterFunction"),
+ engine->toScriptValue(commandPrototype.stderrFilterFunction()));
+ cmd.setProperty(QLatin1String("responseFileThreshold"),
+ engine->toScriptValue(commandPrototype.responseFileThreshold()));
+ cmd.setProperty(QLatin1String("responseFileUsagePrefix"),
+ engine->toScriptValue(commandPrototype.responseFileUsagePrefix()));
+ cmd.setProperty(QLatin1String("environment"),
+ engine->toScriptValue(commandPrototype.environment().toStringList()));
return cmd;
}
@@ -128,7 +139,7 @@ void ProcessCommand::setupForJavaScript(QScriptValue targetObject)
{
QBS_CHECK(targetObject.isObject());
QScriptValue ctor = targetObject.engine()->newFunction(js_Command, 2);
- targetObject.setProperty("Command", ctor);
+ targetObject.setProperty(QLatin1String("Command"), ctor);
}
ProcessCommand::ProcessCommand()
@@ -169,14 +180,18 @@ bool ProcessCommand::equals(const AbstractCommand *otherAbstractCommand) const
void ProcessCommand::fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation)
{
AbstractCommand::fillFromScriptValue(scriptValue, codeLocation);
- m_program = scriptValue->property("program").toString();
- m_arguments = scriptValue->property("arguments").toVariant().toStringList();
- m_workingDir = scriptValue->property("workingDirectory").toString();
- m_maxExitCode = scriptValue->property("maxExitCode").toInt32();
- m_stdoutFilterFunction = scriptValue->property("stdoutFilterFunction").toString();
- m_stderrFilterFunction = scriptValue->property("stderrFilterFunction").toString();
- m_responseFileThreshold = scriptValue->property("responseFileThreshold").toInt32();
- m_responseFileUsagePrefix = scriptValue->property("responseFileUsagePrefix").toString();
+ m_program = scriptValue->property(QLatin1String("program")).toString();
+ m_arguments = scriptValue->property(QLatin1String("arguments")).toVariant().toStringList();
+ m_workingDir = scriptValue->property(QLatin1String("workingDirectory")).toString();
+ m_maxExitCode = scriptValue->property(QLatin1String("maxExitCode")).toInt32();
+ m_stdoutFilterFunction =
+ scriptValue->property(QLatin1String("stdoutFilterFunction")).toString();
+ m_stderrFilterFunction =
+ scriptValue->property(QLatin1String("stderrFilterFunction")).toString();
+ m_responseFileThreshold = scriptValue->property(QLatin1String("responseFileThreshold"))
+ .toInt32();
+ m_responseFileUsagePrefix = scriptValue->property(QLatin1String("responseFileUsagePrefix"))
+ .toString();
QStringList envList = scriptValue->property(QLatin1String("environment")).toVariant()
.toStringList();
getEnvironmentFromList(envList);
@@ -218,13 +233,15 @@ static QScriptValue js_JavaScriptCommand(QScriptContext *context, QScriptEngine
return context->throwError(Tr::tr("JavaScriptCommand constructor called without new."));
if (Q_UNLIKELY(context->argumentCount() != 0)) {
return context->throwError(QScriptContext::SyntaxError,
- "JavaScriptCommand c'tor doesn't take arguments.");
+ QLatin1String("JavaScriptCommand c'tor doesn't take arguments."));
}
static JavaScriptCommand commandPrototype;
QScriptValue cmd = js_CommandBase(context, engine);
- cmd.setProperty("className", engine->toScriptValue(QString("JavaScriptCommand")));
- cmd.setProperty("sourceCode", engine->toScriptValue(commandPrototype.sourceCode()));
+ cmd.setProperty(QLatin1String("className"),
+ engine->toScriptValue(QString::fromLatin1("JavaScriptCommand")));
+ cmd.setProperty(QLatin1String("sourceCode"),
+ engine->toScriptValue(commandPrototype.sourceCode()));
return cmd;
}
@@ -232,7 +249,7 @@ void JavaScriptCommand::setupForJavaScript(QScriptValue targetObject)
{
QBS_CHECK(targetObject.isObject());
QScriptValue ctor = targetObject.engine()->newFunction(js_JavaScriptCommand, 0);
- targetObject.setProperty("JavaScriptCommand", ctor);
+ targetObject.setProperty(QLatin1String("JavaScriptCommand"), ctor);
}
JavaScriptCommand::JavaScriptCommand()
@@ -252,13 +269,14 @@ bool JavaScriptCommand::equals(const AbstractCommand *otherAbstractCommand) cons
void JavaScriptCommand::fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation)
{
AbstractCommand::fillFromScriptValue(scriptValue, codeLocation);
- QScriptValue sourceCode = scriptValue->property("sourceCode");
+ QScriptValue sourceCode = scriptValue->property(QLatin1String("sourceCode"));
if (sourceCode.isFunction())
- m_sourceCode = "(" + sourceCode.toString() + ")()";
+ m_sourceCode = QLatin1String("(") + sourceCode.toString() + QLatin1String(")()");
else
m_sourceCode = sourceCode.toString();
static QSet<QString> predefinedProperties = QSet<QString>()
- << "description" << "highlight" << "silent" << "className" << "sourceCode";
+ << QLatin1String("description") << QLatin1String("highlight") << QLatin1String("silent")
+ << QLatin1String("className") << QLatin1String("sourceCode");
QScriptValueIterator it(*scriptValue);
while (it.hasNext()) {
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp
index fe546c97b..3938e961b 100644
--- a/src/lib/corelib/buildgraph/executor.cpp
+++ b/src/lib/corelib/buildgraph/executor.cpp
@@ -505,7 +505,7 @@ void Executor::buildArtifact(Artifact *artifact)
Artifact *output = *it;
QDir outDir = QFileInfo(output->filePath()).absoluteDir();
if (!outDir.exists())
- outDir.mkpath(".");
+ outDir.mkpath(QLatin1String("."));
}
}
@@ -547,7 +547,7 @@ void Executor::buildArtifact(Artifact *artifact)
m_processingJobs.insert(job, artifact);
Q_ASSERT_X(artifact->product, Q_FUNC_INFO,
- qPrintable(QString("Generated artifact '%1' belongs to no product.")
+ qPrintable(QString::fromLatin1("Generated artifact '%1' belongs to no product.")
.arg(QDir::toNativeSeparators(artifact->filePath()))));
job->run(artifact->transformer.data(), artifact->product);
@@ -724,7 +724,7 @@ void Executor::addExecutorJobs(int jobNumber)
for (int i = 1; i <= jobNumber; i++) {
ExecutorJob *job = new ExecutorJob(m_logger, this);
job->setMainThreadScriptEngine(m_evalContext->engine());
- job->setObjectName(QString(QLatin1String("J%1")).arg(i));
+ job->setObjectName(QString::fromLatin1("J%1").arg(i));
m_availableJobs.append(job);
connect(job, SIGNAL(reportCommandDescription(QString,QString)),
this, SIGNAL(reportCommandDescription(QString,QString)), Qt::QueuedConnection);
@@ -744,7 +744,7 @@ void Executor::runAutoMoc()
throw ErrorInfo(Tr::tr("Build canceled%1.").arg(configString()));
// HACK call the automoc thingy here only if we have use Qt/core module
foreach (const ResolvedModuleConstPtr &m, product->modules) {
- if (m->name == "Qt/core") {
+ if (m->name == QLatin1String("Qt/core")) {
autoMocApplied = true;
m_autoMoc->apply(product);
break;
@@ -817,7 +817,7 @@ void Executor::finish()
m_logger.qbsInfo() << Tr::tr("Build done%1.").arg(configString());
} else {
m_error.append(Tr::tr("The following products could not be built%1: %2.")
- .arg(configString(), unbuiltProductNames.join(", ")));
+ .arg(configString(), unbuiltProductNames.join(QLatin1String(", "))));
}
if (m_explicitlyCanceled)
diff --git a/src/lib/corelib/buildgraph/inputartifactscanner.cpp b/src/lib/corelib/buildgraph/inputartifactscanner.cpp
index d5a0fabb6..ba646c54f 100644
--- a/src/lib/corelib/buildgraph/inputartifactscanner.cpp
+++ b/src/lib/corelib/buildgraph/inputartifactscanner.cpp
@@ -62,12 +62,14 @@ static void collectIncludePaths(const QVariantMap &modules, QSet<QString> *colle
QMapIterator<QString, QVariant> iterator(modules);
while (iterator.hasNext()) {
iterator.next();
- if (iterator.key() == "cpp") {
- QVariant includePathsVariant = iterator .value().toMap().value("includePaths");
+ if (iterator.key() == QLatin1String("cpp")) {
+ QVariant includePathsVariant =
+ iterator.value().toMap().value(QLatin1String("includePaths"));
if (includePathsVariant.isValid())
collectedPaths->unite(QSet<QString>::fromList(includePathsVariant.toStringList()));
} else {
- collectIncludePaths(iterator.value().toMap().value("modules").toMap(), collectedPaths);
+ collectIncludePaths(iterator.value().toMap().value(QLatin1String("modules")).toMap(),
+ collectedPaths);
}
}
}
@@ -184,7 +186,8 @@ void InputArtifactScanner::scan()
if (cacheHit) {
includePaths = cacheItem.includePaths;
} else {
- includePaths = collectIncludePaths(inputArtifact->properties->value().value("modules").toMap());
+ includePaths = collectIncludePaths(inputArtifact->properties->value()
+ .value(QLatin1String("modules")).toMap());
cacheItem.includePaths = includePaths;
cacheItem.valid = true;
}
@@ -212,7 +215,7 @@ void InputArtifactScanner::scanForFileDependencies(ScannerPlugin *scannerPlugin,
{
if (m_logger.debugEnabled()) {
m_logger.qbsDebug() << QString::fromLocal8Bit("scanning %1 [%2]\n from %3")
- .arg(inputArtifact->filePath()).arg(scannerPlugin->fileTag)
+ .arg(inputArtifact->filePath()).arg(QLatin1String(scannerPlugin->fileTag))
.arg(m_artifact->filePath());
}
diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.cpp b/src/lib/corelib/buildgraph/jscommandexecutor.cpp
index 5de52e581..b51dd6475 100644
--- a/src/lib/corelib/buildgraph/jscommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/jscommandexecutor.cpp
@@ -172,7 +172,7 @@ void JsCommandExecutor::onJavaScriptCommandFinished()
if (!result.success) {
logger().qbsDebug() << "JS context:\n" << jsCommand()->properties();
logger().qbsDebug() << "JS code:\n" << jsCommand()->sourceCode();
- QString msg = "Error while executing JavaScriptCommand:\n";
+ QString msg = tr("Error while executing JavaScriptCommand:\n");
msg += result.errorMessage;
emit error(ErrorInfo(msg, result.errorLocation));
}
diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.cpp b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
index 8887cc99f..3c435fcde 100644
--- a/src/lib/corelib/buildgraph/processcommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
@@ -77,7 +77,7 @@ ProcessCommandExecutor::ProcessCommandExecutor(const Logger &logger, QObject *pa
static QString commandArgsToString(const QStringList &args)
{
QString result;
- QRegExp ws("\\s");
+ QRegExp ws(QLatin1String("\\s"));
foreach (const QString &arg, args) {
result += QLatin1Char(' ');
@@ -131,7 +131,7 @@ void ProcessCommandExecutor::doStart()
// We need to delete the file manually, later.
QTemporaryFile responseFile;
responseFile.setAutoRemove(false);
- responseFile.setFileTemplate(QDir::tempPath() + "/qbsresp");
+ responseFile.setFileTemplate(QDir::tempPath() + QLatin1String("/qbsresp"));
if (!responseFile.open()) {
emit error(ErrorInfo(Tr::tr("Cannot create response file '%1'.")
.arg(responseFile.fileName())));
@@ -171,7 +171,9 @@ QString ProcessCommandExecutor::filterProcessOutput(const QByteArray &_output,
if (filterFunctionSource.isEmpty())
return output;
- QScriptValue filterFunction = scriptEngine()->evaluate("var f = " + filterFunctionSource + "; f");
+ QScriptValue filterFunction = scriptEngine()->evaluate(QLatin1String("var f = ")
+ + filterFunctionSource
+ + QLatin1String("; f"));
if (!filterFunction.isFunction()) {
emit error(ErrorInfo(Tr::tr("Error in filter function: %1.\n%2")
.arg(filterFunctionSource, filterFunction.toString())));
@@ -285,8 +287,8 @@ QString ProcessCommandExecutor::findProcessCommandInPath()
if (logger().traceEnabled())
logger().qbsTrace() << "[EXEC] looking for executable in PATH " << fullProgramPath;
const QProcessEnvironment &buildEnvironment = product->buildEnvironment;
- QStringList pathEnv = buildEnvironment.value("PATH").split(HostOsInfo::pathListSeparator(),
- QString::SkipEmptyParts);
+ QStringList pathEnv = buildEnvironment.value(QLatin1String("PATH"))
+ .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
if (HostOsInfo::isWindowsHost())
pathEnv.prepend(QLatin1String("."));
for (int i = 0; i < pathEnv.count(); ++i) {
diff --git a/src/lib/corelib/buildgraph/projectbuilddata.cpp b/src/lib/corelib/buildgraph/projectbuilddata.cpp
index d671a029b..5c2188753 100644
--- a/src/lib/corelib/buildgraph/projectbuilddata.cpp
+++ b/src/lib/corelib/buildgraph/projectbuilddata.cpp
@@ -328,7 +328,8 @@ void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &produc
foreach (const QString &inputFileName, rtrafo->inputs) {
Artifact *artifact = lookupArtifact(product, inputFileName);
if (Q_UNLIKELY(!artifact))
- throw ErrorInfo(QString("Can't find artifact '%0' in the list of source files.").arg(inputFileName));
+ throw ErrorInfo(Tr::tr("Can't find artifact '%0' in the list of source files.")
+ .arg(inputFileName));
inputArtifacts += artifact;
}
TransformerPtr transformer = Transformer::create();
@@ -369,7 +370,8 @@ void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &produc
ScriptEngine::argumentList(transformer->rule->prepareScript->argumentNames,
prepareScriptContext));
if (Q_UNLIKELY(transformer->commands.isEmpty()))
- throw ErrorInfo(QString("There's a transformer without commands."), rtrafo->transform->location);
+ throw ErrorInfo(Tr::tr("There's a transformer without commands."),
+ rtrafo->transform->location);
}
// Handle Transformer.explicitlyDependsOn after all transformer outputs have been created.
diff --git a/src/lib/corelib/buildgraph/rulesapplicator.cpp b/src/lib/corelib/buildgraph/rulesapplicator.cpp
index 8a60c709e..e5b5621da 100644
--- a/src/lib/corelib/buildgraph/rulesapplicator.cpp
+++ b/src/lib/corelib/buildgraph/rulesapplicator.cpp
@@ -100,8 +100,9 @@ void RulesApplicator::doApply(const ArtifactList &inputArtifacts,
evalContext()->checkForCancelation();
if (m_logger.debugEnabled()) {
- m_logger.qbsDebug() << "[BG] apply rule " << m_rule->toString() << " "
- << toStringList(inputArtifacts).join(",\n ");
+ m_logger.qbsDebug() << QString::fromLatin1("[BG] apply rule ") << m_rule->toString()
+ << QString::fromLatin1(" ")
+ << toStringList(inputArtifacts).join(QLatin1String(",\n "));
}
QList<QPair<const RuleArtifact *, Artifact *> > ruleArtifactArtifactMap;
@@ -171,22 +172,25 @@ void RulesApplicator::doApply(const ArtifactList &inputArtifacts,
Artifact *outputArtifact = ruleArtifactArtifactMap.at(i).second;
outputArtifact->properties = outputArtifact->properties->clone();
- scope().setProperty("fileName", engine()->toScriptValue(outputArtifact->filePath()));
- scope().setProperty("fileTags",
+ scope().setProperty(QLatin1String("fileName"),
+ engine()->toScriptValue(outputArtifact->filePath()));
+ scope().setProperty(QLatin1String("fileTags"),
toScriptValue(engine(), outputArtifact->fileTags.toStringList()));
- QVariantMap artifactModulesCfg = outputArtifact->properties->value().value("modules").toMap();
+ QVariantMap artifactModulesCfg = outputArtifact->properties->value()
+ .value(QLatin1String("modules")).toMap();
for (int i=0; i < ra->bindings.count(); ++i) {
const RuleArtifact::Binding &binding = ra->bindings.at(i);
scriptValue = engine()->evaluate(binding.code);
if (Q_UNLIKELY(engine()->hasErrorOrException(scriptValue))) {
QString msg = QLatin1String("evaluating rule binding '%1': %2");
- throw ErrorInfo(msg.arg(binding.name.join(QLatin1String(".")), scriptValue.toString()), binding.location);
+ throw ErrorInfo(msg.arg(binding.name.join(QLatin1String(".")),
+ scriptValue.toString()), binding.location);
}
setConfigProperty(artifactModulesCfg, binding.name, scriptValue.toVariant());
}
QVariantMap outputArtifactConfig = outputArtifact->properties->value();
- outputArtifactConfig.insert("modules", artifactModulesCfg);
+ outputArtifactConfig.insert(QLatin1String("modules"), artifactModulesCfg);
outputArtifact->properties->setValue(outputArtifactConfig);
}
if (!ruleArtifactArtifactMap.isEmpty())
@@ -196,7 +200,8 @@ void RulesApplicator::doApply(const ArtifactList &inputArtifacts,
m_transformer->createCommands(m_rule->prepareScript, evalContext(),
ScriptEngine::argumentList(m_rule->prepareScript->argumentNames, prepareScriptContext));
if (Q_UNLIKELY(m_transformer->commands.isEmpty()))
- throw ErrorInfo(QString("There's a rule without commands: %1.").arg(m_rule->toString()), m_rule->prepareScript->location);
+ throw ErrorInfo(Tr::tr("There's a rule without commands: %1.")
+ .arg(m_rule->toString()), m_rule->prepareScript->location);
}
void RulesApplicator::setupScriptEngineForArtifact(Artifact *artifact)
@@ -217,13 +222,13 @@ void RulesApplicator::setupScriptEngineForArtifact(Artifact *artifact)
// expose per file properties we want to use in an Artifact within a Rule
QScriptValue scriptValue = engine()->newObject();
ModuleProperties::init(scriptValue, artifact);
- scriptValue.setProperty("fileName", inFileName);
- scriptValue.setProperty("baseName", inBaseName);
- scriptValue.setProperty("completeBaseName", inCompleteBaseName);
- scriptValue.setProperty("baseDir", basedir);
+ scriptValue.setProperty(QLatin1String("fileName"), inFileName);
+ scriptValue.setProperty(QLatin1String("baseName"), inBaseName);
+ scriptValue.setProperty(QLatin1String("completeBaseName"), inCompleteBaseName);
+ scriptValue.setProperty(QLatin1String("baseDir"), basedir);
- scope().setProperty("input", scriptValue);
- Q_ASSERT_X(scriptValue.strictlyEquals(engine()->evaluate("input")),
+ scope().setProperty(QLatin1String("input"), scriptValue);
+ Q_ASSERT_X(scriptValue.strictlyEquals(engine()->evaluate(QLatin1String("input"))),
"BG", "The input object is not in current scope.");
}
@@ -232,9 +237,11 @@ Artifact *RulesApplicator::createOutputArtifact(const RuleArtifactConstPtr &rule
{
QScriptValue scriptValue = engine()->evaluate(ruleArtifact->fileName);
if (Q_UNLIKELY(engine()->hasErrorOrException(scriptValue)))
- throw ErrorInfo("Error in Rule.Artifact fileName: " + scriptValue.toString());
+ throw ErrorInfo(Tr::tr("Error in Rule.Artifact fileName: ") + scriptValue.toString());
QString outputPath = scriptValue.toString();
- outputPath.replace("..", "dotdot"); // don't let the output artifact "escape" its build dir
+
+ // Don't let the output artifact "escape" its build dir
+ outputPath.replace(QLatin1String(".."), QLatin1String("dotdot"));
outputPath = resolveOutPath(outputPath);
Artifact *outputArtifact = lookupArtifact(m_product, outputPath);
@@ -252,18 +259,21 @@ Artifact *RulesApplicator::createOutputArtifact(const RuleArtifactConstPtr &rule
m_transformer->inputs.unite(inputArtifacts);
if (Q_UNLIKELY(m_transformer->inputs.count() > 1 && !m_rule->multiplex)) {
- QString th = "[" + outputArtifact->fileTags.toStringList().join(", ") + "]";
- QString e = Tr::tr("Conflicting rules for producing %1 %2 \n").arg(outputArtifact->filePath(), th);
- th = "[" + m_rule->inputs.toStringList().join(", ")
- + "] -> [" + outputArtifact->fileTags.toStringList().join(", ") + "]";
-
- e += QString(" while trying to apply: %1:%2:%3 %4\n")
+ QString th = QLatin1Char('[') + outputArtifact->fileTags.toStringList()
+ .join(QLatin1String(", ")) + QLatin1Char(']');
+ QString e = Tr::tr("Conflicting rules for producing %1 %2 \n")
+ .arg(outputArtifact->filePath(), th);
+ th = QLatin1Char('[') + m_rule->inputs.toStringList().join(QLatin1String(", "))
+ + QLatin1String("] -> [") + outputArtifact->fileTags.toStringList()
+ .join(QLatin1String(", ")) + QLatin1Char(']');
+
+ e += QString::fromLatin1(" while trying to apply: %1:%2:%3 %4\n")
.arg(m_rule->prepareScript->location.fileName())
.arg(m_rule->prepareScript->location.line())
.arg(m_rule->prepareScript->location.column())
.arg(th);
- e += QString(" was already defined in: %1:%2:%3 %4\n")
+ e += QString::fromLatin1(" was already defined in: %1:%2:%3 %4\n")
.arg(outputArtifact->transformer->rule->prepareScript->location.fileName())
.arg(outputArtifact->transformer->rule->prepareScript->location.line())
.arg(outputArtifact->transformer->rule->prepareScript->location.column())
diff --git a/src/lib/corelib/buildgraph/transformer.cpp b/src/lib/corelib/buildgraph/transformer.cpp
index 5c095f9db..87bc45527 100644
--- a/src/lib/corelib/buildgraph/transformer.cpp
+++ b/src/lib/corelib/buildgraph/transformer.cpp
@@ -96,14 +96,14 @@ void Transformer::setupInputs(QScriptEngine *scriptEngine, QScriptValue targetSc
{
const QString &defaultModuleName = rule->module->name;
QScriptValue scriptValue = translateInOutputs(scriptEngine, inputs, defaultModuleName);
- targetScriptValue.setProperty("inputs", scriptValue);
+ targetScriptValue.setProperty(QLatin1String("inputs"), scriptValue);
if (inputs.count() == 1) {
Artifact *input = *inputs.begin();
const FileTags &fileTags = input->fileTags;
QBS_ASSERT(!fileTags.isEmpty(), return);
QScriptValue inputsForFileTag = scriptValue.property(fileTags.begin()->toString());
QScriptValue inputScriptValue = inputsForFileTag.property(0);
- targetScriptValue.setProperty("input", inputScriptValue);
+ targetScriptValue.setProperty(QLatin1String("input"), inputScriptValue);
} else {
targetScriptValue.setProperty(QLatin1String("input"), scriptEngine->undefinedValue());
}
@@ -113,14 +113,14 @@ void Transformer::setupOutputs(QScriptEngine *scriptEngine, QScriptValue targetS
{
const QString &defaultModuleName = rule->module->name;
QScriptValue scriptValue = translateInOutputs(scriptEngine, outputs, defaultModuleName);
- targetScriptValue.setProperty("outputs", scriptValue);
+ targetScriptValue.setProperty(QLatin1String("outputs"), scriptValue);
if (outputs.count() == 1) {
Artifact *output = *outputs.begin();
const FileTags &fileTags = output->fileTags;
QBS_ASSERT(!fileTags.isEmpty(), return);
QScriptValue outputsForFileTag = scriptValue.property(fileTags.begin()->toString());
QScriptValue outputScriptValue = outputsForFileTag.property(0);
- targetScriptValue.setProperty("output", outputScriptValue);
+ targetScriptValue.setProperty(QLatin1String("output"), outputScriptValue);
} else {
targetScriptValue.setProperty(QLatin1String("output"), scriptEngine->undefinedValue());
}
@@ -132,10 +132,10 @@ static AbstractCommand *createCommandFromScriptValue(const QScriptValue &scriptV
if (scriptValue.isUndefined() || !scriptValue.isValid())
return 0;
AbstractCommand *cmdBase = 0;
- QString className = scriptValue.property("className").toString();
- if (className == "Command")
+ QString className = scriptValue.property(QLatin1String("className")).toString();
+ if (className == QLatin1String("Command"))
cmdBase = new ProcessCommand;
- else if (className == "JavaScriptCommand")
+ else if (className == QLatin1String("JavaScriptCommand"))
cmdBase = new JavaScriptCommand;
if (cmdBase)
cmdBase->fillFromScriptValue(&scriptValue, codeLocation);
@@ -157,14 +157,15 @@ void Transformer::createCommands(const ScriptFunctionConstPtr &script,
propertiesRequestedFromArtifactInPrepareScript = engine->propertiesRequestedFromArtifact();
engine->clearRequestedProperties();
if (Q_UNLIKELY(engine->hasErrorOrException(scriptValue)))
- throw ErrorInfo("evaluating prepare script: " + engine->uncaughtException().toString(),
+ throw ErrorInfo(Tr::tr("evaluating prepare script: ")
+ + engine->uncaughtException().toString(),
CodeLocation(script->location.fileName(),
script->location.line() + engine->uncaughtExceptionLineNumber() - 1));
qDeleteAll(commands);
commands.clear();
if (scriptValue.isArray()) {
- const int count = scriptValue.property("length").toInt32();
+ const int count = scriptValue.property(QLatin1String("length")).toInt32();
for (qint32 i = 0; i < count; ++i) {
QScriptValue item = scriptValue.property(i);
if (item.isValid() && !item.isUndefined()) {
diff --git a/src/lib/corelib/jsextensions/domxml.cpp b/src/lib/corelib/jsextensions/domxml.cpp
index a66f2b21b..5042a54d7 100644
--- a/src/lib/corelib/jsextensions/domxml.cpp
+++ b/src/lib/corelib/jsextensions/domxml.cpp
@@ -40,9 +40,9 @@ void initializeJsExtensionXml(QScriptValue extensionObject)
{
QScriptEngine *engine = extensionObject.engine();
QScriptValue obj = engine->newQMetaObject(&XmlDomDocument::staticMetaObject, engine->newFunction(&XmlDomDocument::ctor));
- extensionObject.setProperty("XmlDomDocument", obj);
+ extensionObject.setProperty(QLatin1String("XmlDomDocument"), obj);
obj = engine->newQMetaObject(&XmlDomNode::staticMetaObject, engine->newFunction(&XmlDomNode::ctor));
- extensionObject.setProperty("XmlDomElement", obj);
+ extensionObject.setProperty(QLatin1String("XmlDomElement"), obj);
}
QScriptValue XmlDomDocument::ctor(QScriptContext *context, QScriptEngine *engine)
@@ -56,7 +56,7 @@ QScriptValue XmlDomDocument::ctor(QScriptContext *context, QScriptEngine *engine
xml = new XmlDomDocument(context, context->argument(0).toString());
break;
default:
- return context->throwError("DomXml(QString file = QLatin1String(\"\"))");
+ return context->throwError(QLatin1String("DomXml(QString file = QLatin1String(\"\"))"));
}
QScriptValue obj = engine->newQObject(xml, QScriptEngine::ScriptOwnership);
return obj;
diff --git a/src/lib/corelib/jsextensions/file.cpp b/src/lib/corelib/jsextensions/file.cpp
index 1e6f2947c..34dadc7e6 100644
--- a/src/lib/corelib/jsextensions/file.cpp
+++ b/src/lib/corelib/jsextensions/file.cpp
@@ -56,11 +56,11 @@ void initializeJsExtensionFile(QScriptValue extensionObject)
{
QScriptEngine *engine = extensionObject.engine();
QScriptValue fileObj = engine->newFunction(File::js_ctor);
- fileObj.setProperty("copy", engine->newFunction(File::js_copy));
- fileObj.setProperty("exists", engine->newFunction(File::js_exists));
- fileObj.setProperty("lastModified", engine->newFunction(File::js_lastModified));
- fileObj.setProperty("remove", engine->newFunction(File::js_remove));
- extensionObject.setProperty("File", fileObj);
+ fileObj.setProperty(QLatin1String("copy"), engine->newFunction(File::js_copy));
+ fileObj.setProperty(QLatin1String("exists"), engine->newFunction(File::js_exists));
+ fileObj.setProperty(QLatin1String("lastModified"), engine->newFunction(File::js_lastModified));
+ fileObj.setProperty(QLatin1String("remove"), engine->newFunction(File::js_remove));
+ extensionObject.setProperty(QLatin1String("File"), fileObj);
}
QScriptValue File::js_ctor(QScriptContext *context, QScriptEngine *engine)
diff --git a/src/lib/corelib/jsextensions/moduleproperties.cpp b/src/lib/corelib/jsextensions/moduleproperties.cpp
index 83d92e776..1d8286320 100644
--- a/src/lib/corelib/jsextensions/moduleproperties.cpp
+++ b/src/lib/corelib/jsextensions/moduleproperties.cpp
@@ -61,9 +61,9 @@ void ModuleProperties::init(QScriptValue objectWithProperties, const void *ptr,
const QString &type)
{
QScriptEngine * const engine = objectWithProperties.engine();
- objectWithProperties.setProperty("moduleProperties",
+ objectWithProperties.setProperty(QLatin1String("moduleProperties"),
engine->newFunction(ModuleProperties::js_moduleProperties, 2));
- objectWithProperties.setProperty("moduleProperty",
+ objectWithProperties.setProperty(QLatin1String("moduleProperty"),
engine->newFunction(ModuleProperties::js_moduleProperty, 2));
objectWithProperties.setProperty(ptrKey(), engine->toScriptValue(quintptr(ptr)));
objectWithProperties.setProperty(typeKey(), type);
diff --git a/src/lib/corelib/jsextensions/process.cpp b/src/lib/corelib/jsextensions/process.cpp
index 3cf74ab31..6d7922e7b 100644
--- a/src/lib/corelib/jsextensions/process.cpp
+++ b/src/lib/corelib/jsextensions/process.cpp
@@ -45,7 +45,7 @@ void initializeJsExtensionProcess(QScriptValue extensionObject)
{
QScriptEngine *engine = extensionObject.engine();
QScriptValue obj = engine->newQMetaObject(&Process::staticMetaObject, engine->newFunction(&Process::ctor));
- extensionObject.setProperty("Process", obj);
+ extensionObject.setProperty(QLatin1String("Process"), obj);
}
QScriptValue Process::ctor(QScriptContext *context, QScriptEngine *engine)
@@ -56,7 +56,7 @@ QScriptValue Process::ctor(QScriptContext *context, QScriptEngine *engine)
t = new Process(context);
break;
default:
- return context->throwError("Process()");
+ return context->throwError(QLatin1String("Process()"));
}
QScriptValue obj = engine->newQObject(t, QScriptEngine::ScriptOwnership);
diff --git a/src/lib/corelib/jsextensions/textfile.cpp b/src/lib/corelib/jsextensions/textfile.cpp
index 7129ee955..f3912f07d 100644
--- a/src/lib/corelib/jsextensions/textfile.cpp
+++ b/src/lib/corelib/jsextensions/textfile.cpp
@@ -43,7 +43,7 @@ void initializeJsExtensionTextFile(QScriptValue extensionObject)
{
QScriptEngine *engine = extensionObject.engine();
QScriptValue obj = engine->newQMetaObject(&TextFile::staticMetaObject, engine->newFunction(&TextFile::ctor));
- extensionObject.setProperty("TextFile", obj);
+ extensionObject.setProperty(QLatin1String("TextFile"), obj);
}
QScriptValue TextFile::ctor(QScriptContext *context, QScriptEngine *engine)
@@ -68,7 +68,9 @@ QScriptValue TextFile::ctor(QScriptContext *context, QScriptEngine *engine)
);
break;
default:
- return context->throwError("TextFile(QString file, OpenMode mode = ReadOnly, QString codec = QLatin1String(\"UTF8\"))");
+ return context->throwError(QLatin1String("TextFile(QString file, "
+ "OpenMode mode = ReadOnly, "
+ "QString codec = QLatin1String(\"UTF8\"))"));
}
QScriptValue obj = engine->newQObject(t, QScriptEngine::ScriptOwnership);
diff --git a/src/lib/corelib/language/builtindeclarations.cpp b/src/lib/corelib/language/builtindeclarations.cpp
index 4bbc02579..f214aa248 100644
--- a/src/lib/corelib/language/builtindeclarations.cpp
+++ b/src/lib/corelib/language/builtindeclarations.cpp
@@ -144,7 +144,7 @@ void BuiltinDeclarations::setupItemForBuiltinType(Item *item) const
JSSourceValuePtr sourceValue = JSSourceValue::create();
sourceValue->setFile(item->file());
sourceValue->setSourceCode(pd.initialValueSource.isEmpty() ?
- "undefined" : pd.initialValueSource);
+ QLatin1String("undefined") : pd.initialValueSource);
value = sourceValue;
}
}
@@ -299,7 +299,7 @@ void BuiltinDeclarations::addProductItem()
decl.initialValueSource = QLatin1String("[]");
item << decl;
item << nameProperty();
- decl = PropertyDeclaration("targetName", PropertyDeclaration::String);
+ decl = PropertyDeclaration(QLatin1String("targetName"), PropertyDeclaration::String);
decl.initialValueSource = QLatin1String("name");
item << decl;
decl = PropertyDeclaration(QLatin1String("destinationDirectory"), PropertyDeclaration::String);
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index fb89f53e6..4a5250964 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -443,121 +443,121 @@ QScriptValue EvaluatorScriptClass::js_getHostOS(QScriptContext *context, QScript
QStringList hostSystem;
#if defined(Q_OS_AIX)
- hostSystem << "aix";
+ hostSystem << QLatin1String("aix");
#endif
#if defined(Q_OS_ANDROID)
- hostSystem << "android";
+ hostSystem << QLatin1String("android");
#endif
#if defined(Q_OS_BLACKBERRY)
- hostSystem << "blackberry";
+ hostSystem << QLatin1String("blackberry");
#endif
#if defined(Q_OS_BSD4)
- hostSystem << "bsd" << "bsd4";
+ hostSystem << QLatin1String("bsd") << QLatin1String("bsd4");
#endif
#if defined(Q_OS_BSDI)
- hostSystem << "bsdi";
+ hostSystem << QLatin1String("bsdi");
#endif
#if defined(Q_OS_CYGWIN)
- hostSystem << "cygwin";
+ hostSystem << QLatin1String("cygwin");
#endif
#if defined(Q_OS_DARWIN)
- hostSystem << "darwin";
+ hostSystem << QLatin1String("darwin");
#endif
#if defined(Q_OS_DGUX)
- hostSystem << "dgux";
+ hostSystem << QLatin1String("dgux");
#endif
#if defined(Q_OS_DYNIX)
- hostSystem << "dynix";
+ hostSystem << QLatin1String("dynix");
#endif
#if defined(Q_OS_FREEBSD)
- hostSystem << "freebsd";
+ hostSystem << QLatin1String("freebsd");
#endif
#if defined(Q_OS_HPUX)
- hostSystem << "hpux";
+ hostSystem << QLatin1String("hpux");
#endif
#if defined(Q_OS_HURD)
- hostSystem << "hurd";
+ hostSystem << QLatin1String("hurd");
#endif
#if defined(Q_OS_INTEGRITY)
- hostSystem << "integrity";
+ hostSystem << QLatin1String("integrity");
#endif
#if defined(Q_OS_IOS)
- hostSystem << "ios";
+ hostSystem << QLatin1String("ios");
#endif
#if defined(Q_OS_IRIX)
- hostSystem << "irix";
+ hostSystem << QLatin1String("irix");
#endif
#if defined(Q_OS_LINUX)
- hostSystem << "linux";
+ hostSystem << QLatin1String("linux");
#endif
#if defined(Q_OS_LYNX)
- hostSystem << "lynx";
+ hostSystem << QLatin1String("lynx");
#endif
#if defined(Q_OS_MACX)
- hostSystem << "osx";
+ hostSystem << QLatin1String("osx");
#endif
#if defined(Q_OS_MSDOS)
- hostSystem << "msdos";
+ hostSystem << QLatin1String("msdos");
#endif
#if defined(Q_OS_NACL)
- hostSystem << "nacl";
+ hostSystem << QLatin1String("nacl");
#endif
#if defined(Q_OS_NETBSD)
- hostSystem << "netbsd";
+ hostSystem << QLatin1String("netbsd");
#endif
#if defined(Q_OS_OPENBSD)
- hostSystem << "openbsd";
+ hostSystem << QLatin1String("openbsd");
#endif
#if defined(Q_OS_OS2)
- hostSystem << "os2";
+ hostSystem << QLatin1String("os2");
#endif
#if defined(Q_OS_OS2EMX)
- hostSystem << "os2emx";
+ hostSystem << QLatin1String("os2emx");
#endif
#if defined(Q_OS_OSF)
- hostSystem << "osf";
+ hostSystem << QLatin1String("osf");
#endif
#if defined(Q_OS_QNX)
- hostSystem << "qnx";
+ hostSystem << QLatin1String("qnx");
#endif
#if defined(Q_OS_ONX6)
- hostSystem << "qnx6";
+ hostSystem << QLatin1String("qnx6");
#endif
#if defined(Q_OS_RELIANT)
- hostSystem << "reliant";
+ hostSystem << QLatin1String("reliant");
#endif
#if defined(Q_OS_SCO)
- hostSystem << "sco";
+ hostSystem << QLatin1String("sco");
#endif
#if defined(Q_OS_SOLARIS)
- hostSystem << "solaris";
+ hostSystem << QLatin1String("solaris");
#endif
#if defined(Q_OS_SYMBIAN)
- hostSystem << "symbian";
+ hostSystem << QLatin1String("symbian");
#endif
#if defined(Q_OS_ULTRIX)
- hostSystem << "ultrix";
+ hostSystem << QLatin1String("ultrix");
#endif
#if defined(Q_OS_UNIX)
- hostSystem << "unix";
+ hostSystem << QLatin1String("unix");
#endif
#if defined(Q_OS_UNIXWARE)
- hostSystem << "unixware";
+ hostSystem << QLatin1String("unixware");
#endif
#if defined(Q_OS_VXWORKS)
- hostSystem << "vxworks";
+ hostSystem << QLatin1String("vxworks");
#endif
#if defined(Q_OS_WIN32)
- hostSystem << "windows";
+ hostSystem << QLatin1String("windows");
#endif
#if defined(Q_OS_WINCE)
- hostSystem << "windowsce";
+ hostSystem << QLatin1String("windowsce");
#endif
#if defined(Q_OS_WINPHONE)
- hostSystem << "windowsphone";
+ hostSystem << QLatin1String("windowsphone");
#endif
#if defined(Q_OS_WINRT)
- hostSystem << "winrt";
+ hostSystem << QLatin1String("winrt");
#endif
return engine->toScriptValue(hostSystem);
diff --git a/src/lib/corelib/language/itemreaderastvisitor.cpp b/src/lib/corelib/language/itemreaderastvisitor.cpp
index a08a73648..33fe97e6b 100644
--- a/src/lib/corelib/language/itemreaderastvisitor.cpp
+++ b/src/lib/corelib/language/itemreaderastvisitor.cpp
@@ -104,7 +104,7 @@ void ItemReaderASTVisitor::collectPrototypes(const QString &path, const QString
return;
}
- QDirIterator dirIter(path, QStringList("*.qbs"));
+ QDirIterator dirIter(path, QStringList(QLatin1String("*.qbs")));
while (dirIter.hasNext()) {
const QString filePath = dirIter.next();
const QString fileName = dirIter.fileName();
@@ -205,12 +205,12 @@ bool ItemReaderASTVisitor::visit(AST::UiImportList *uiImportList)
if (fi.isDir()) {
collectPrototypes(name, as);
} else {
- if (name.endsWith(".js", Qt::CaseInsensitive)) {
+ if (name.endsWith(QLatin1String(".js"), Qt::CaseInsensitive)) {
JsImport &jsImport = jsImports[as];
jsImport.scopeName = as;
jsImport.fileNames.append(name);
jsImport.location = toCodeLocation(import->firstSourceLocation());
- } else if (name.endsWith(".qbs", Qt::CaseInsensitive)) {
+ } else if (name.endsWith(QLatin1String(".qbs"), Qt::CaseInsensitive)) {
m_typeNameToFile.insert(QStringList(as), name);
} else {
throw ErrorInfo(Tr::tr("Can only import .qbs and .js files"),
@@ -225,13 +225,15 @@ bool ItemReaderASTVisitor::visit(AST::UiImportList *uiImportList)
if (!found) {
foreach (const QString &searchPath, m_reader->searchPaths()) {
const QFileInfo fi(FileInfo::resolvePath(
- FileInfo::resolvePath(searchPath, "imports"), importPath));
+ FileInfo::resolvePath(searchPath,
+ QLatin1String("imports")),
+ importPath));
if (fi.isDir()) {
// ### versioning, qbsdir file, etc.
const QString &resultPath = fi.absoluteFilePath();
collectPrototypes(resultPath, as);
- QDirIterator dirIter(resultPath, QStringList("*.js"));
+ QDirIterator dirIter(resultPath, QStringList(QLatin1String("*.js")));
while (dirIter.hasNext()) {
dirIter.next();
JsImport &jsImport = jsImports[as];
@@ -247,8 +249,9 @@ bool ItemReaderASTVisitor::visit(AST::UiImportList *uiImportList)
}
}
if (Q_UNLIKELY(!found)) {
- throw ErrorInfo(Tr::tr("import %1 not found").arg(importUri.join(".")),
- toCodeLocation(import->fileNameToken));
+ throw ErrorInfo(Tr::tr("import %1 not found")
+ .arg(importUri.join(QLatin1String("."))),
+ toCodeLocation(import->fileNameToken));
}
}
}
@@ -317,7 +320,7 @@ void ItemReaderASTVisitor::checkDuplicateBinding(Item *item, const QStringList &
{
if (Q_UNLIKELY(item->properties().contains(bindingName.last()))) {
QString msg = Tr::tr("Duplicate binding for '%1'");
- throw ErrorInfo(msg.arg(bindingName.join(".")),
+ throw ErrorInfo(msg.arg(bindingName.join(QLatin1String("."))),
qbs::Internal::toCodeLocation(m_file->filePath(), sourceLocation));
}
}
@@ -401,8 +404,8 @@ bool ItemReaderASTVisitor::visit(AST::FunctionDeclaration *ast)
// remove the name
QString funcNoName = textOf(m_sourceCode, ast);
- funcNoName.replace(QRegExp("^(\\s*function\\s*)\\w*"), "(\\1");
- funcNoName.append(")");
+ funcNoName.replace(QRegExp(QLatin1String("^(\\s*function\\s*)\\w*")), QLatin1String("(\\1"));
+ funcNoName.append(QLatin1Char(')'));
f.setSourceCode(funcNoName);
f.setLocation(toCodeLocation(ast->firstSourceLocation()));
@@ -418,8 +421,8 @@ bool ItemReaderASTVisitor::visitStatement(AST::Statement *statement)
QString sourceCode = textOf(m_sourceCode, statement);
if (AST::cast<AST::Block *>(statement)) {
// rewrite blocks to be able to use return statements in property assignments
- sourceCode.prepend("(function()");
- sourceCode.append(")()");
+ sourceCode.prepend(QLatin1String("(function()"));
+ sourceCode.append(QLatin1String(")()"));
m_sourceValue->m_hasFunctionForm = true;
}
diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp
index be02b03ee..ac553a111 100644
--- a/src/lib/corelib/language/language.cpp
+++ b/src/lib/corelib/language/language.cpp
@@ -582,11 +582,11 @@ static QProcessEnvironment getProcessEnvironment(ScriptEngine *engine, EnvType e
const QScriptValue putEnvValue = engine->newFunction(js_putEnv, 1);
// TODO: Remove in 1.3
- scope.setProperty("getenv", getEnvValue);
- scope.setProperty("putenv", putEnvValue);
+ scope.setProperty(QLatin1String("getenv"), getEnvValue);
+ scope.setProperty(QLatin1String("putenv"), putEnvValue);
- scope.setProperty("getEnv", getEnvValue);
- scope.setProperty("putEnv", putEnvValue);
+ scope.setProperty(QLatin1String("getEnv"), getEnvValue);
+ scope.setProperty(QLatin1String("putEnv"), putEnvValue);
QSet<QString> seenModuleNames;
QList<const ResolvedModule *> topSortedModules = topSortModules(moduleChildren, rootModules, seenModuleNames);
@@ -612,7 +612,8 @@ static QProcessEnvironment getProcessEnvironment(ScriptEngine *engine, EnvType e
// expose properties of direct module dependencies
QScriptValue scriptValue;
- QVariantMap productModules = productConfiguration->value().value("modules").toMap();
+ QVariantMap productModules = productConfiguration->value()
+ .value(QLatin1String("modules")).toMap();
foreach (const ResolvedModule * const depmod, moduleChildren.value(module)) {
scriptValue = engine->newObject();
QVariantMap moduleCfg = productModules.value(depmod->name).toMap();
@@ -631,8 +632,10 @@ static QProcessEnvironment getProcessEnvironment(ScriptEngine *engine, EnvType e
scriptValue = engine->evaluate(setupScript->sourceCode + QLatin1String("()"));
ctx->popScope();
if (Q_UNLIKELY(engine->hasErrorOrException(scriptValue))) {
- QString envTypeStr = (envType == BuildEnv ? "build" : "run");
- throw ErrorInfo(QString("Error while setting up %1 environment: %2").arg(envTypeStr, scriptValue.toString()));
+ QString envTypeStr = (envType == BuildEnv
+ ? QLatin1String("build") : QLatin1String("run"));
+ throw ErrorInfo(Tr::tr("Error while setting up %1 environment: %2")
+ .arg(envTypeStr, scriptValue.toString()));
}
}
@@ -917,7 +920,7 @@ QSet<QString> SourceWildCards::expandPatterns(const GroupConstPtr &group,
QSet<QString> files;
foreach (QString pattern, patterns) {
pattern.prepend(prefix);
- pattern.replace('\\', '/');
+ pattern.replace(QLatin1Char('\\'), QLatin1Char('/'));
QStringList parts = pattern.split(QLatin1Char('/'), QString::SkipEmptyParts);
if (FileInfo::isAbsolute(pattern)) {
QString rootDir;
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index a0c06bb61..dbbef4612 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -255,9 +255,9 @@ void ModuleLoader::handleProject(ModuleLoaderResult *loadResult, Item *item,
QList<Item *> projectChildren = projectContext.item->children();
projectChildren += subItem;
projectContext.item->setChildren(projectChildren);
- if (subItem->typeName() == "Product") {
+ if (subItem->typeName() == QLatin1String("Product")) {
handleProduct(&projectContext, subItem);
- } else if (subItem->typeName() == "Project") {
+ } else if (subItem->typeName() == QLatin1String("Project")) {
copyProperties(item, subItem);
handleProject(loadResult, subItem,
QSet<QString>(referencedFilePaths) << absReferencePath);
@@ -532,8 +532,8 @@ void ModuleLoader::resolveDependsItem(DependsContext *dependsContext, Item *item
m_logger.qbsTrace() << "Depends item disabled, ignoring.";
return;
}
- const QString name = m_evaluator->property(dependsItem, "name").toString();
- const QStringList nameParts = name.split('.');
+ const QString name = m_evaluator->property(dependsItem, QLatin1String("name")).toString();
+ const QStringList nameParts = name.split(QLatin1Char('.'));
if (Q_UNLIKELY(nameParts.count() > 2)) {
QString msg = Tr::tr("There cannot be more than one dot in a module name.");
throw ErrorInfo(msg, dependsItem->location());
@@ -1075,7 +1075,7 @@ Item *ModuleLoader::wrapWithProject(Item *item)
Item *prj = Item::create(item->pool());
prj->setChildren(QList<Item *>() << item);
item->setParent(prj);
- prj->setTypeName("Project");
+ prj->setTypeName(QLatin1String("Project"));
prj->setFile(item->file());
prj->setLocation(item->location());
m_reader->builtins()->setupItemForBuiltinType(prj);
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp
index 05a9b3aab..316f797e2 100644
--- a/src/lib/corelib/language/projectresolver.cpp
+++ b/src/lib/corelib/language/projectresolver.cpp
@@ -286,7 +286,7 @@ void ProjectResolver::resolveProduct(Item *item, ProjectContext *projectContext)
product->name = m_evaluator->stringValue(item, QLatin1String("name"));
if (product->name.isEmpty()) {
product->name = FileInfo::completeBaseName(item->file()->filePath());
- item->setProperty("name", VariantValue::create(product->name));
+ item->setProperty(QLatin1String("name"), VariantValue::create(product->name));
}
m_logger.qbsTrace() << "[PR] resolveProduct " << product->name;
@@ -361,11 +361,13 @@ void ProjectResolver::resolveModule(const QStringList &moduleName, Item *item,
const ResolvedModulePtr &module = moduleContext.module;
module->name = ModuleLoader::fullModuleName(moduleName);
- module->setupBuildEnvironmentScript = scriptFunctionValue(item, "setupBuildEnvironment");
- module->setupRunEnvironmentScript = scriptFunctionValue(item, "setupRunEnvironment");
+ module->setupBuildEnvironmentScript = scriptFunctionValue(item,
+ QLatin1String("setupBuildEnvironment"));
+ module->setupRunEnvironmentScript = scriptFunctionValue(item,
+ QLatin1String("setupRunEnvironment"));
m_productContext->product->additionalFileTags
- += m_evaluator->fileTagsValue(item, "additionalProductFileTags");
+ += m_evaluator->fileTagsValue(item, QLatin1String("additionalProductFileTags"));
foreach (const Item::Module &m, item->modules())
module->moduleDependencies += ModuleLoader::fullModuleName(m.name);
@@ -469,7 +471,8 @@ void ProjectResolver::resolveGroup(Item *item, ProjectContext *projectContext)
if (!patterns.isEmpty()) {
SourceWildCards::Ptr wildcards = SourceWildCards::create();
- wildcards->excludePatterns = m_evaluator->stringListValue(item, "excludeFiles");
+ wildcards->excludePatterns = m_evaluator->stringListValue(item,
+ QLatin1String("excludeFiles"));
wildcards->prefix = group->prefix;
wildcards->patterns = patterns;
QSet<QString> files = wildcards->expandPatterns(group, m_productContext->product->sourceDirectory);
@@ -486,13 +489,14 @@ void ProjectResolver::resolveGroup(Item *item, ProjectContext *projectContext)
foreach (const SourceArtifactConstPtr &a, group->files) {
if (!FileInfo(a->absoluteFilePath).exists()) {
fileError.append(Tr::tr("File '%1' does not exist.")
- .arg(a->absoluteFilePath), item->property("files")->location());
+ .arg(a->absoluteFilePath),
+ item->property(QLatin1String("files"))->location());
}
}
if (fileError.hasError())
throw ErrorInfo(fileError);
- group->name = m_evaluator->stringValue(item, "name");
+ group->name = m_evaluator->stringValue(item, QLatin1String("name"));
if (group->name.isEmpty())
group->name = Tr::tr("Group %1").arg(m_productContext->product->groups.count());
group->properties = properties;
@@ -568,11 +572,12 @@ void ProjectResolver::resolveRule(Item *item, ProjectContext *projectContext)
rule->prepareScript = scriptFunctionValue(item, QLatin1String("prepare"));
rule->multiplex = m_evaluator->boolValue(item, QLatin1String("multiplex"));
- rule->inputs = m_evaluator->fileTagsValue(item, "inputs");
- rule->usings = m_evaluator->fileTagsValue(item, "usings");
+ rule->inputs = m_evaluator->fileTagsValue(item, QLatin1String("inputs"));
+ rule->usings = m_evaluator->fileTagsValue(item, QLatin1String("usings"));
rule->auxiliaryInputs
= m_evaluator->fileTagsValue(item, QLatin1String("auxiliaryInputs"));
- rule->explicitlyDependsOn = m_evaluator->fileTagsValue(item, "explicitlyDependsOn");
+ rule->explicitlyDependsOn
+ = m_evaluator->fileTagsValue(item, QLatin1String("explicitlyDependsOn"));
rule->module = m_moduleContext ? m_moduleContext->module : projectContext->dummyModule;
if (m_productContext)
m_productContext->product->rules += rule;
@@ -610,9 +615,9 @@ void ProjectResolver::resolveRuleArtifact(const RulePtr &rule, Item *item,
return;
RuleArtifactPtr artifact = RuleArtifact::create();
rule->artifacts += artifact;
- artifact->fileName = verbatimValue(item, "fileName");
- artifact->fileTags = m_evaluator->fileTagsValue(item, "fileTags");
- artifact->alwaysUpdated = m_evaluator->boolValue(item, "alwaysUpdated");
+ artifact->fileName = verbatimValue(item, QLatin1String("fileName"));
+ artifact->fileTags = m_evaluator->fileTagsValue(item, QLatin1String("fileTags"));
+ artifact->alwaysUpdated = m_evaluator->boolValue(item, QLatin1String("alwaysUpdated"));
if (artifact->alwaysUpdated)
*hasAlwaysUpdatedArtifact = true;
@@ -664,7 +669,7 @@ void ProjectResolver::resolveFileTagger(Item *item, ProjectContext *projectConte
QList<FileTaggerConstPtr> &fileTaggers = m_productContext
? m_productContext->product->fileTaggers : projectContext->fileTaggers;
QStringList patterns = m_evaluator->stringListValue(item, QLatin1String("patterns"));
- const FileTags fileTags = m_evaluator->fileTagsValue(item, "fileTags");
+ const FileTags fileTags = m_evaluator->fileTagsValue(item, QLatin1String("fileTags"));
if (fileTags.isEmpty())
throw ErrorInfo(Tr::tr("FileTagger.fileTags must not be empty."), item->location());
@@ -691,30 +696,31 @@ void ProjectResolver::resolveFileTagger(Item *item, ProjectContext *projectConte
void ProjectResolver::resolveTransformer(Item *item, ProjectContext *projectContext)
{
checkCancelation();
- if (!m_evaluator->boolValue(item, "condition")) {
+ if (!m_evaluator->boolValue(item, QLatin1String("condition"))) {
m_logger.qbsTrace() << "[PR] transformer condition is false";
return;
}
ResolvedTransformerPtr rtrafo = ResolvedTransformer::create();
rtrafo->module = m_moduleContext ? m_moduleContext->module : projectContext->dummyModule;
- rtrafo->inputs = m_evaluator->stringListValue(item, "inputs");
+ rtrafo->inputs = m_evaluator->stringListValue(item, QLatin1String("inputs"));
for (int i = 0; i < rtrafo->inputs.count(); ++i)
rtrafo->inputs[i] = FileInfo::resolvePath(m_productContext->product->sourceDirectory, rtrafo->inputs.at(i));
rtrafo->transform = scriptFunctionValue(item, QLatin1String("prepare"));
- rtrafo->explicitlyDependsOn = m_evaluator->fileTagsValue(item, "explicitlyDependsOn");
+ rtrafo->explicitlyDependsOn = m_evaluator->fileTagsValue(item,
+ QLatin1String("explicitlyDependsOn"));
foreach (const Item *child, item->children()) {
if (Q_UNLIKELY(child->typeName() != QLatin1String("Artifact")))
throw ErrorInfo(Tr::tr("Transformer: wrong child type '%0'.").arg(child->typeName()));
SourceArtifactPtr artifact = SourceArtifact::create();
artifact->properties = m_productContext->product->properties;
- QString fileName = m_evaluator->stringValue(child, "fileName");
+ QString fileName = m_evaluator->stringValue(child, QLatin1String("fileName"));
if (Q_UNLIKELY(fileName.isEmpty()))
throw ErrorInfo(Tr::tr("Artifact fileName must not be empty."));
artifact->absoluteFilePath = FileInfo::resolvePath(m_productContext->product->topLevelProject()->buildDirectory,
fileName);
- artifact->fileTags = m_evaluator->fileTagsValue(child, "fileTags");
+ artifact->fileTags = m_evaluator->fileTagsValue(child, QLatin1String("fileTags"));
if (artifact->fileTags.isEmpty())
artifact->fileTags.insert(unknownFileTag());
rtrafo->outputs += artifact;
@@ -871,7 +877,7 @@ void ProjectResolver::evaluateModuleValues(Item *item, QVariantMap *modulesMap)
const Item::Module &module = *it;
evaluateModuleValues(module.item, &depmods);
QVariantMap dep = evaluateProperties(module.item);
- dep.insert("modules", depmods);
+ dep.insert(QLatin1String("modules"), depmods);
modulesMap->insert(ModuleLoader::fullModuleName(module.name), dep);
}
}
diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp
index e7f475d4c..2a45badc7 100644
--- a/src/lib/corelib/language/scriptengine.cpp
+++ b/src/lib/corelib/language/scriptengine.cpp
@@ -55,7 +55,7 @@ ScriptEngine::ScriptEngine(const Logger &logger, QObject *parent)
QScriptValue objectProto = globalObject().property(QLatin1String("Object"));
m_definePropertyFunction = objectProto.property(QLatin1String("defineProperty"));
QBS_ASSERT(m_definePropertyFunction.isFunction(), /* ignore */);
- m_emptyFunction = evaluate("(function(){})");
+ m_emptyFunction = evaluate(QLatin1String("(function(){})"));
QBS_ASSERT(m_emptyFunction.isFunction(), /* ignore */);
// Initially push a new context to turn off scope chain insanity mode.
QScriptEngine::pushContext();
diff --git a/src/lib/corelib/logging/ilogsink.cpp b/src/lib/corelib/logging/ilogsink.cpp
index 118fdf106..01128b3c8 100644
--- a/src/lib/corelib/logging/ilogsink.cpp
+++ b/src/lib/corelib/logging/ilogsink.cpp
@@ -38,7 +38,7 @@ namespace qbs {
QString logLevelTag(LoggerLevel level)
{
if (level == LoggerInfo)
- return QByteArray();
+ return QString();
QString str = logLevelName(level).toUpper();
if (!str.isEmpty())
str.append(QLatin1String(": "));
diff --git a/src/lib/corelib/logging/logger.cpp b/src/lib/corelib/logging/logger.cpp
index 9f7a19c01..efc87e4cc 100644
--- a/src/lib/corelib/logging/logger.cpp
+++ b/src/lib/corelib/logging/logger.cpp
@@ -150,7 +150,7 @@ LogWriter operator<<(LogWriter w, const QSet<QString> &strSet)
LogWriter operator<<(LogWriter w, const QVariant &variant)
{
- QString str = variant.typeName() + QLatin1Char('(');
+ QString str = QLatin1String(variant.typeName()) + QLatin1Char('(');
if (variant.type() == QVariant::List) {
bool firstLoop = true;
foreach (const QVariant &item, variant.toList()) {
@@ -180,7 +180,7 @@ LogWriter operator<<(LogWriter w, qint64 n)
LogWriter operator<<(LogWriter w, bool b)
{
- return w << QString(QLatin1String(b ? "true" : "false"));
+ return w << QString::fromLatin1(b ? "true" : "false");
}
LogWriter operator<<(LogWriter w, const MessageTag &tag)
diff --git a/src/lib/corelib/tools/qbsassert.cpp b/src/lib/corelib/tools/qbsassert.cpp
index 46ea58b83..fc093a979 100644
--- a/src/lib/corelib/tools/qbsassert.cpp
+++ b/src/lib/corelib/tools/qbsassert.cpp
@@ -42,8 +42,8 @@ void writeAssertLocation(const char *condition, const char *file, int line)
void throwAssertLocation(const char *condition, const char *file, int line)
{
- throw ErrorInfo(QString(QLatin1String("ASSERT: %1")).arg(condition),
- CodeLocation(QString::fromLocal8Bit(file), line), true);
+ throw ErrorInfo(QString::fromLatin1("ASSERT: %1").arg(QLatin1String(condition)),
+ CodeLocation(QString::fromLocal8Bit(file), line), true);
}
} // namespace Internal
diff --git a/src/lib/corelib/tools/scannerpluginmanager.cpp b/src/lib/corelib/tools/scannerpluginmanager.cpp
index 3c5dad702..e795da159 100644
--- a/src/lib/corelib/tools/scannerpluginmanager.cpp
+++ b/src/lib/corelib/tools/scannerpluginmanager.cpp
@@ -68,11 +68,11 @@ void ScannerPluginManager::loadPlugins(const QStringList &pluginPaths, const Log
QStringList filters;
if (HostOsInfo::isWindowsHost())
- filters << "*.dll";
+ filters << QLatin1String("*.dll");
else if (HostOsInfo::isOsxHost())
- filters << "*.dylib";
+ filters << QLatin1String("*.dylib");
else
- filters << "*.so";
+ filters << QLatin1String("*.so");
foreach (const QString &pluginPath, pluginPaths) {
logger.qbsTrace() << QString::fromLocal8Bit("pluginmanager: loading plugins from '%1'.")
diff --git a/src/lib/corelib/tools/scripttools.cpp b/src/lib/corelib/tools/scripttools.cpp
index c87898da5..1f9344264 100644
--- a/src/lib/corelib/tools/scripttools.cpp
+++ b/src/lib/corelib/tools/scripttools.cpp
@@ -80,49 +80,49 @@ QVariant getConfigProperty(const QVariantMap &cfg, const QStringList &name)
QString toJSLiteral(const bool b)
{
- return b ? "true" : "false";
+ return b ? QLatin1String("true") : QLatin1String("false");
}
QString toJSLiteral(const QString &str)
{
QString js = str;
- js.replace(QRegExp("([\\\\\"])"), "\\\\1");
- js.prepend('"');
- js.append('"');
+ js.replace(QRegExp(QLatin1String("([\\\\\"])")), QLatin1String("\\\\1"));
+ js.prepend(QLatin1Char('"'));
+ js.append(QLatin1Char('"'));
return js;
}
QString toJSLiteral(const QStringList &strs)
{
- QString js = "[";
+ QString js = QLatin1String("[");
for (int i = 0; i < strs.count(); ++i) {
if (i != 0)
- js.append(", ");
+ js.append(QLatin1String(", "));
js.append(toJSLiteral(strs.at(i)));
}
- js.append(']');
+ js.append(QLatin1Char(']'));
return js;
}
QString toJSLiteral(const QVariant &val)
{
if (!val.isValid()) {
- return "undefined";
+ return QLatin1String("undefined");
} else if (val.type() == QVariant::List || val.type() == QVariant::StringList) {
QString res;
foreach (const QVariant &child, val.toList()) {
- if (res.length()) res.append(", ");
+ if (res.length()) res.append(QLatin1String(", "));
res.append(toJSLiteral(child));
}
- res.prepend("[");
- res.append("]");
+ res.prepend(QLatin1Char('['));
+ res.append(QLatin1Char(']'));
return res;
} else if (val.type() == QVariant::Bool) {
- return val.toBool() ? "true" : "false";
+ return val.toBool() ? QLatin1String("true") : QLatin1String("false");
} else if (val.canConvert(QVariant::String)) {
return QLatin1Char('"') + val.toString() + QLatin1Char('"');
} else {
- return QString("Unconvertible type %1").arg(val.typeName());
+ return QString::fromLatin1("Unconvertible type %1").arg(QLatin1String(val.typeName()));
}
}
diff --git a/src/lib/corelib/tools/setupprojectparameters.cpp b/src/lib/corelib/tools/setupprojectparameters.cpp
index 9f6c07cb8..354bb6e0d 100644
--- a/src/lib/corelib/tools/setupprojectparameters.cpp
+++ b/src/lib/corelib/tools/setupprojectparameters.cpp
@@ -275,7 +275,7 @@ ErrorInfo SetupProjectParameters::expandBuildConfiguration(Settings *settings)
// Fill in buildCfg in this order (making sure not to overwrite a key already set by a previous stage)
// 1) Things specified on command line (already in buildCfg at this point)
// 2) Everything from the profile key
- QString profileName = expandedConfig.value("qbs.profile").toString();
+ QString profileName = expandedConfig.value(QLatin1String("qbs.profile")).toString();
if (profileName.isNull()) {
profileName = settings->defaultProfile();
if (profileName.isNull()) {
@@ -289,7 +289,7 @@ ErrorInfo SetupProjectParameters::expandBuildConfiguration(Settings *settings)
.arg(profileNames));
return err;
}
- expandedConfig.insert("qbs.profile", profileName);
+ expandedConfig.insert(QLatin1String("qbs.profile"), profileName);
}
// (2)
diff --git a/src/plugins/scanner/qt/qtscanner.cpp b/src/plugins/scanner/qt/qtscanner.cpp
index 7d263ddae..750b14f29 100644
--- a/src/plugins/scanner/qt/qtscanner.cpp
+++ b/src/plugins/scanner/qt/qtscanner.cpp
@@ -138,7 +138,7 @@ static const char *nextQrc(void *opaq, int *size, int *flags)
o->xml->readNext();
switch (o->xml->tokenType()) {
case QXmlStreamReader::StartElement:
- if ( o->xml->name() == "file") {
+ if (o->xml->name() == QLatin1String("file")) {
o->current = o->xml->readElementText(QXmlStreamReader::ErrorOnUnexpectedElement).toUtf8();
*flags = SC_LOCAL_INCLUDE_FLAG;
*size = o->current.size();