Commit 6431ab2c authored by hjk's avatar hjk Committed by Eike Ziller
Browse files

Use Qt 5's QStringList::join(QChar)



Less typing and less cycles than join(QString) where appropriate

Change-Id: I6ebc0e17e4d7fd9845864dd95b7de4ba4dad6906
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 2b5df11c
......@@ -452,7 +452,7 @@ int main(int argc, char **argv)
}
}
if (!coreplugin) {
QString nativePaths = QDir::toNativeSeparators(pluginPaths.join(QLatin1String(",")));
QString nativePaths = QDir::toNativeSeparators(pluginPaths.join(QLatin1Char(',')));
const QString reason = QCoreApplication::translate("Application", "Could not find 'Core.pluginspec' in %1").arg(nativePaths);
displayError(msgCoreLoadFailure(reason));
return 1;
......
......@@ -517,7 +517,7 @@ QString PluginManager::serializedArguments()
rc += QLatin1Char(':');
rc += ps->name();
rc += separator;
rc += ps->arguments().join(QString(separator));
rc += ps->arguments().join(separator);
}
}
if (!d->arguments.isEmpty()) {
......
......@@ -465,7 +465,7 @@ void DeclarativeToolsClient::createQmlObject(const QString &qmlText,
log(LogSend, cmd, QString::fromLatin1("%1 %2 [%3] %4").arg(qmlText,
QString::number(parentDebugId),
imports.join(QLatin1String(",")), filename));
imports.join(QLatin1Char(',')), filename));
sendMessage(message);
}
......
......@@ -112,7 +112,7 @@ void QmlToolsClient::messageReceived(const QByteArray &message)
}
}
log(LogReceive, type + ':' + event,
QString::fromLatin1("[%1]").arg(debugIdStrings.join(QLatin1String(","))));
QString::fromLatin1("[%1]").arg(debugIdStrings.join(QLatin1Char(','))));
emit currentObjectsChanged(m_currentDebugIds);
}
} else {
......@@ -277,7 +277,7 @@ void QmlToolsClient::createQmlObject(const QString &qmlText,
log(LogSend, CREATE_OBJECT, QString::fromLatin1("%1 %2 [%3] %4").arg(qmlText,
QString::number(parentDebugId),
imports.join(QLatin1String(",")), filename));
imports.join(QLatin1Char(',')), filename));
sendMessage(message);
}
......
......@@ -303,7 +303,7 @@ void CompletionContextFinder::checkImport()
YY_RESTORE();
if (m_inImport && isInLibVersionImport == 1) {
m_libVersion = libVersionImport.join(QLatin1String(""));
m_libVersion = libVersionImport.join(QString());
if (m_libVersion.isNull())
m_libVersion = QLatin1String("");
} else {
......
......@@ -481,10 +481,10 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
--iPath;
if (safeName.indexIn(myPath.at(iPath)) != 0)
break;
ImportKey iKey(ImportType::Library, QStringList(myPath.mid(iPath)).join(QLatin1String(".")),
ImportKey iKey(ImportType::Library, QStringList(myPath.mid(iPath)).join(QLatin1Char('.')),
importKey.majorVersion, importKey.minorVersion);
cImport.possibleExports.append(Export(iKey, (iPath == 1) ? QLatin1String("/") :
QStringList(myPath.mid(0, iPath)).join(QLatin1String("/")), true));
QStringList(myPath.mid(0, iPath)).join(QLatin1Char('/')), true));
}
} else {
QString requiredPath = QStringList(splitPath.mid(0, splitPath.size() - importKey.splitPath.size()))
......@@ -512,10 +512,10 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
--iPath;
if (safeName.indexIn(splitPath.at(iPath)) != 0)
break;
ImportKey iKey(ImportType::Library, QStringList(splitPath.mid(iPath)).join(QLatin1String(".")),
ImportKey iKey(ImportType::Library, QStringList(splitPath.mid(iPath)).join(QLatin1Char('.')),
majorVersion, minorVersion);
cImport.possibleExports.append(Export(iKey, (iPath == 1) ? QLatin1String("/") :
QStringList(splitPath.mid(0, iPath)).join(QLatin1String("/")), true));
QStringList(splitPath.mid(0, iPath)).join(QLatin1Char('/')), true));
}
}
foreach (const QmlDirParser::Component &component, info.components()) {
......
......@@ -200,7 +200,7 @@ ImportKey ImportKey::flatKey() const {
QString ImportKey::libraryQualifiedPath() const
{
QString res = splitPath.join(QString::fromLatin1("."));
QString res = splitPath.join(QLatin1Char('.'));
if (res.isEmpty() && !splitPath.isEmpty())
return QLatin1String("");
return res;
......@@ -208,7 +208,7 @@ QString ImportKey::libraryQualifiedPath() const
QString ImportKey::path() const
{
QString res = splitPath.join(QString::fromLatin1("/"));
QString res = splitPath.join(QLatin1Char('/'));
if (res.isEmpty() && !splitPath.isEmpty())
return QLatin1String("/");
return res;
......@@ -442,7 +442,7 @@ QString ImportKey::toString() const
res = path();
break;
case ImportType::Library:
res = splitPath.join(QLatin1String("."));
res = splitPath.join(QLatin1Char('.'));
break;
}
......
......@@ -431,7 +431,7 @@ Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInf
"%1\n\n"
"For qmake projects, use the QML_IMPORT_PATH variable to add import paths.\n"
"For qmlproject projects, use the importPaths property to add import paths.").arg(
importPaths.join(QLatin1String("\n"))));
importPaths.join(QLatin1Char('\n'))));
}
return import;
......
......@@ -241,7 +241,7 @@ static QString qmldumpErrorMessage(const QString &libraryPath, const QString &er
static QString qmldumpFailedMessage(const QString &libraryPath, const QString &error)
{
QString firstLines =
QStringList(error.split(QLatin1Char('\n')).mid(0, 10)).join(QLatin1String("\n"));
QStringList(error.split(QLatin1Char('\n')).mid(0, 10)).join(QLatin1Char('\n'));
return noTypeinfoError(libraryPath) + QLatin1String("\n\n") +
PluginDumper::tr("Automatic type dump of QML module failed.\n"
"First 10 lines or errors:\n"
......@@ -412,9 +412,9 @@ void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
if (errors.isEmpty()) {
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::TypeInfoFileDone);
} else {
printParseWarnings(libraryPath, errors.join(QLatin1String("\n")));
printParseWarnings(libraryPath, errors.join(QLatin1Char('\n')));
errors.prepend(tr("Errors while reading typeinfo files:"));
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::TypeInfoFileError, errors.join(QLatin1String("\n")));
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::TypeInfoFileError, errors.join(QLatin1Char('\n')));
}
if (!warnings.isEmpty())
......
......@@ -301,7 +301,7 @@ protected:
continue;
// the extra space is to avoid // comments sticking to the 0 offset
QString indentLine = newContext.join(QLatin1String("\n")) + QLatin1String("\n ") + restLine;
QString indentLine = newContext.join(QLatin1Char('\n')) + QLatin1String("\n ") + restLine;
int indent = tryIndent(indentLine);
QList<Split> newSplits = possibleSplits.mid(i + 1);
......
......@@ -235,7 +235,7 @@ static bool runBuildProcess(QProcess &proc,
QString cmd = binary.toString();
if (!args.isEmpty()) {
cmd += QLatin1Char(' ');
cmd += args.join(QString(QLatin1Char(' ')));
cmd += args.join(QLatin1Char(' '));
}
*errorMessage =
QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
......@@ -287,7 +287,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
log->append(newline);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(),
qmakeArgs.join(QLatin1String(" "))));
qmakeArgs.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30000, false, log, errorMessage))
return false;
......@@ -299,7 +299,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
}
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n")
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1String(" "))));
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120000, false, log, errorMessage))
return false;
return true;
......
......@@ -202,7 +202,7 @@ QStringList PathListEditor::pathList() const
void PathListEditor::setPathList(const QStringList &l)
{
d->edit->setPlainText(l.join(QString(QLatin1Char('\n'))));
d->edit->setPlainText(l.join(QLatin1Char('\n')));
}
void PathListEditor::setPathList(const QString &pathString)
......
......@@ -539,7 +539,7 @@ AndroidConfig::CreateAvdInfo AndroidConfig::createAVDImpl(CreateAvdInfo info, Ut
proc.start(androidToolPath.toString(), arguments);
if (!proc.waitForStarted()) {
info.error = QApplication::translate("AndroidConfig", "Could not start process \"%1 %2\"")
.arg(androidToolPath.toString(), arguments.join(QLatin1String(" ")));
.arg(androidToolPath.toString(), arguments.join(QLatin1Char(' ')));
return info;
}
......
......@@ -328,18 +328,18 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
void AndroidDeployQtStep::runCommand(const QString &program, const QStringList &arguments)
{
QProcess buildProc;
emit addOutput(tr("Package deploy: Running command \"%1 %2\".").arg(program).arg(arguments.join(QLatin1String(" "))), BuildStep::MessageOutput);
emit addOutput(tr("Package deploy: Running command \"%1 %2\".").arg(program).arg(arguments.join(QLatin1Char(' '))), BuildStep::MessageOutput);
buildProc.start(program, arguments);
if (!buildProc.waitForStarted()) {
emit addOutput(tr("Packaging error: Could not start command \"%1 %2\". Reason: %3")
.arg(program).arg(arguments.join(QLatin1String(" "))).arg(buildProc.errorString()), BuildStep::ErrorMessageOutput);
.arg(program).arg(arguments.join(QLatin1Char(' '))).arg(buildProc.errorString()), BuildStep::ErrorMessageOutput);
return;
}
if (!buildProc.waitForFinished(2 * 60 * 1000)
|| buildProc.error() != QProcess::UnknownError
|| buildProc.exitCode() != 0) {
QString mainMessage = tr("Packaging Error: Command \"%1 %2\" failed.")
.arg(program).arg(arguments.join(QLatin1String(" ")));
.arg(program).arg(arguments.join(QLatin1Char(' ')));
if (buildProc.error() != QProcess::UnknownError)
mainMessage += QLatin1Char(' ') + tr("Reason: %1").arg(buildProc.errorString());
else
......
......@@ -183,7 +183,7 @@ public:
QString lineText;
if (node->incompatibleReason().isEmpty()) {
lineText = AndroidManager::androidNameForApiLevel(device.sdk) + QLatin1String(" ");
lineText += AndroidDeviceDialog::tr("ABI:") + device.cpuAbi.join(QLatin1String(" "));
lineText += AndroidDeviceDialog::tr("ABI:") + device.cpuAbi.join(QLatin1Char(' '));
} else {
lineText = node->incompatibleReason();
}
......@@ -342,7 +342,7 @@ void AndroidDeviceModel::setDevices(const QVector<AndroidDeviceInfo> &devices)
.arg(device.serialNumber);
} else if (!device.cpuAbi.contains(m_abi)) {
error = AndroidDeviceDialog::tr("ABI is incompatible, device supports ABIs: %1.")
.arg(device.cpuAbi.join(QLatin1String(" ")));
.arg(device.cpuAbi.join(QLatin1Char(' ')));
} else if (device.sdk < m_apiLevel) {
error = AndroidDeviceDialog::tr("API Level of device is: %1.")
.arg(device.sdk);
......
......@@ -416,7 +416,7 @@ static QString loadLocal(ProjectExplorer::Target *target, int apiLevel, ItemType
// The next loop requires all library names to end with a ":" so we append one
// to the end after joining.
localLibs = dependencyLibs.join(QLatin1String(":")) + QLatin1Char(':');
localLibs = dependencyLibs.join(QLatin1Char(':')) + QLatin1Char(':');
foreach (QString replacedLib, replacedLibs)
localLibs.remove(replacedLib + QLatin1Char(':'));
......@@ -486,7 +486,7 @@ void AndroidManager::cleanLibsOnDevice(ProjectExplorer::Target *target)
arguments << QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/tmp/qt");
process->connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString();
Core::MessageManager::write(adb + QLatin1Char(' ') + arguments.join(QLatin1String(" ")));
Core::MessageManager::write(adb + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')));
process->start(adb, arguments);
if (!process->waitForStarted(500))
delete process;
......@@ -516,7 +516,7 @@ void AndroidManager::installQASIPackage(ProjectExplorer::Target *target, const Q
process->connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
const QString adb = AndroidConfigurations::currentConfig().adbToolPath().toString();
Core::MessageManager::write(adb + QLatin1Char(' ') + arguments.join(QLatin1String(" ")));
Core::MessageManager::write(adb + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')));
process->start(adb, arguments);
if (!process->waitForFinished(500))
delete process;
......
......@@ -207,7 +207,7 @@ void ArtisticStyleSettings::createDocumentationFile() const
const QString text = QLatin1String("<p><span class=\"option\">")
+ keys.filter(QRegExp(QLatin1String("^\\-"))).join(QLatin1String(", "))
+ QLatin1String("</span></p><p>")
+ Qt::escape(docu.join(QLatin1String(" ")))
+ Qt::escape(docu.join(QLatin1Char(' ')))
+ QLatin1String("</p>");
stream.writeTextElement(QLatin1String(Constants::DOCUMENTATION_XMLDOC), text);
stream.writeEndElement();
......
......@@ -66,7 +66,7 @@ void ConfigurationSyntaxHighlighter::setKeywords(const QStringList &keywords)
pattern << QRegExp::escape(word);
}
m_expressionKeyword.setPattern(QLatin1String("(?:\\s|^)(") + pattern.join(QLatin1String("|"))
m_expressionKeyword.setPattern(QLatin1String("(?:\\s|^)(") + pattern.join(QLatin1Char('|'))
+ QLatin1String(")(?=\\s|\\:|\\=|\\,|$)"));
}
......
......@@ -153,7 +153,7 @@ void UncrustifySettings::createDocumentationFile() const
const QString text = QLatin1String("<p><span class=\"option\">") + keyword
+ QLatin1String("</span> <span class=\"param\">") + options
+ QLatin1String("</span></p><p>")
+ Qt::escape(docu.join(QLatin1String(" ")))
+ Qt::escape(docu.join(QLatin1Char(' ')))
+ QLatin1String("</p>");
stream.writeStartElement(QLatin1String(Constants::DOCUMENTATION_XMLENTRY));
stream.writeTextElement(QLatin1String(Constants::DOCUMENTATION_XMLKEY), keyword);
......
......@@ -95,7 +95,7 @@ static QString commandLine(const QStringList &options, const QString &fileName)
foreach (const QString &option, allOptions)
allOptionsQuoted.append(QLatin1Char('\'') + option + QLatin1Char('\''));
return ::Utils::HostOsInfo::withExecutableSuffix(QLatin1String("clang"))
+ QLatin1Char(' ') + allOptionsQuoted.join(QLatin1String(" "));
+ QLatin1Char(' ') + allOptionsQuoted.join(QLatin1Char(' '));
}
void CreateMarkers::run()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment