Use QLatin1String overload for string concat

GIT_SILENT
parent 21caef57
...@@ -309,7 +309,7 @@ void OutputExecuteJob::start() ...@@ -309,7 +309,7 @@ void OutputExecuteJob::start()
} else { } else {
KDevelop::ICore::self()->runtimeController()->currentRuntime()->startProcess(d->m_process); KDevelop::ICore::self()->runtimeController()->currentRuntime()->startProcess(d->m_process);
} }
model()->appendLine(d->m_process->workingDirectory() + QStringLiteral("> ") + KShell::joinArgs(d->m_process->program())); model()->appendLine(d->m_process->workingDirectory() + QLatin1String("> ") + KShell::joinArgs(d->m_process->program()));
} else { } else {
QString errorMessage = i18n("Failed to specify program to start: %1", d->joinCommandLine()); QString errorMessage = i18n("Failed to specify program to start: %1", d->joinCommandLine());
model()->appendLine( i18n( "*** %1 ***", errorMessage) ); model()->appendLine( i18n( "*** %1 ***", errorMessage) );
......
...@@ -1003,7 +1003,7 @@ QString DocumentController::activeDocumentPath( const QString& target ) const ...@@ -1003,7 +1003,7 @@ QString DocumentController::activeDocumentPath( const QString& target ) const
{ {
QString ret = static_cast<ProjectItemContext*>(selection)->items().at(0)->path().pathOrUrl(); QString ret = static_cast<ProjectItemContext*>(selection)->items().at(0)->path().pathOrUrl();
if(static_cast<ProjectItemContext*>(selection)->items().at(0)->folder()) if(static_cast<ProjectItemContext*>(selection)->items().at(0)->folder())
ret += QStringLiteral("/."); ret += QLatin1String("/.");
return ret; return ret;
} }
return QString(); return QString();
......
...@@ -44,7 +44,7 @@ QString dBusServiceNameForSession( const QString& id ) ...@@ -44,7 +44,7 @@ QString dBusServiceNameForSession( const QString& id )
{ {
// We remove starting "{" and ending "}" from the string UUID representation // We remove starting "{" and ending "}" from the string UUID representation
// as D-Bus apparently doesn't allow them in service names // as D-Bus apparently doesn't allow them in service names
return QStringLiteral( "org.kdevelop.kdevplatform-lock-" ) + id.midRef( 1, id.size() - 2 ); return QLatin1String("org.kdevelop.kdevplatform-lock-") + id.midRef(1, id.size() - 2);
} }
/// Force-removes the lock-file. /// Force-removes the lock-file.
......
...@@ -437,14 +437,15 @@ QString SourceFormatterController::addModelineForCurrentLang(QString input, cons ...@@ -437,14 +437,15 @@ QString SourceFormatterController::addModelineForCurrentLang(QString input, cons
QString modeline(QStringLiteral("// kate: ") QString modeline(QStringLiteral("// kate: ")
+ QStringLiteral("indent-mode ") + indentationMode(mime) + QStringLiteral("; ")); + QLatin1String("indent-mode ") + indentationMode(mime) + QLatin1String("; "));
if(indentation.indentWidth) // We know something about indentation-width if(indentation.indentWidth) // We know something about indentation-width
modeline.append(QStringLiteral("indent-width %1; ").arg(indentation.indentWidth)); modeline.append(QStringLiteral("indent-width %1; ").arg(indentation.indentWidth));
if(indentation.indentationTabWidth != 0) // We know something about tab-usage if(indentation.indentationTabWidth != 0) // We know something about tab-usage
{ {
modeline.append(QStringLiteral("replace-tabs %1; ").arg(QLatin1String((indentation.indentationTabWidth == -1) ? "on" : "off"))); const auto state = (indentation.indentationTabWidth == -1) ? QLatin1String("on") : QLatin1String("off");
modeline += QLatin1String("replace-tabs ") + state + QLatin1String("; ");
if(indentation.indentationTabWidth > 0) if(indentation.indentationTabWidth > 0)
modeline.append(QStringLiteral("tab-width %1; ").arg(indentation.indentationTabWidth)); modeline.append(QStringLiteral("tab-width %1; ").arg(indentation.indentationTabWidth));
} }
......
...@@ -141,7 +141,7 @@ QString qvariantToString(const QVariant& variant) ...@@ -141,7 +141,7 @@ QString qvariantToString(const QVariant& variant)
s << variant; s << variant;
} }
QString result = QStringLiteral("@Variant(") + QString::fromLatin1(a.constData(), a.size()) + QLatin1Char(')'); QString result = QLatin1String("@Variant(") + QString::fromLatin1(a.constData(), a.size()) + QLatin1Char(')');
return result; return result;
} }
......
...@@ -54,7 +54,7 @@ QString BazaarUtils::getRevisionSpec(const KDevelop::VcsRevision& revision) ...@@ -54,7 +54,7 @@ QString BazaarUtils::getRevisionSpec(const KDevelop::VcsRevision& revision)
else else
return QString(); // Don't know how to handle this situation return QString(); // Don't know how to handle this situation
} else if (revision.revisionType() == KDevelop::VcsRevision::GlobalNumber) } else if (revision.revisionType() == KDevelop::VcsRevision::GlobalNumber)
return QStringLiteral("-r") + QString::number(revision.revisionValue().toLongLong()); return QLatin1String("-r") + QString::number(revision.revisionValue().toLongLong());
else else
return QString(); // Don't know how to handle this situation return QString(); // Don't know how to handle this situation
} }
...@@ -107,9 +107,9 @@ QString BazaarUtils::getRevisionSpecRange(const KDevelop::VcsRevision& begin, ...@@ -107,9 +107,9 @@ QString BazaarUtils::getRevisionSpecRange(const KDevelop::VcsRevision& begin,
} else if (begin.revisionType() == KDevelop::VcsRevision::GlobalNumber) { } else if (begin.revisionType() == KDevelop::VcsRevision::GlobalNumber) {
if (end.revisionType() == KDevelop::VcsRevision::Special) { if (end.revisionType() == KDevelop::VcsRevision::Special) {
// Assuming working copy // Assuming working copy
return QStringLiteral("-r") + QString::number(begin.revisionValue().toLongLong()); return QLatin1String("-r") + QString::number(begin.revisionValue().toLongLong());
} else { } else {
return QStringLiteral("-r") + QString::number(begin.revisionValue().toLongLong()) return QLatin1String("-r") + QString::number(begin.revisionValue().toLongLong())
+ QLatin1String("..") + QString::number(end.revisionValue().toLongLong()); + QLatin1String("..") + QString::number(end.revisionValue().toLongLong());
} }
} }
......
...@@ -738,8 +738,8 @@ public: ...@@ -738,8 +738,8 @@ public:
auto decl = pair.first; auto decl = pair.first;
if (matchedTypes.contains(decl->indexedType())) { if (matchedTypes.contains(decl->indexedType())) {
auto parent = pair.second; auto parent = pair.second;
const QString access = parent->abstractType()->whichType() == AbstractType::TypePointer const QLatin1String access = (parent->abstractType()->whichType() == AbstractType::TypePointer)
? QStringLiteral("->") : QStringLiteral("."); ? QLatin1String("->") : QLatin1String(".");
const QString text = parent->identifier().toString() + access + decl->identifier().toString(); const QString text = parent->identifier().toString() + access + decl->identifier().toString();
auto item = new DeclarationItem(decl, text, {}, text); auto item = new DeclarationItem(decl, text, {}, text);
item->setMatchQuality(8); item->setMatchQuality(8);
...@@ -943,7 +943,7 @@ ClangCodeCompletionContext::ClangCodeCompletionContext(const DUContextPointer& c ...@@ -943,7 +943,7 @@ ClangCodeCompletionContext::ClangCodeCompletionContext(const DUContextPointer& c
if (trimmedText.endsWith(QLatin1Char('.'))) { if (trimmedText.endsWith(QLatin1Char('.'))) {
// TODO: This shouldn't be needed if Clang provided diagnostic. // TODO: This shouldn't be needed if Clang provided diagnostic.
// But it doesn't always do it, so let's try to manually determine whether '.' is used instead of '->' // But it doesn't always do it, so let's try to manually determine whether '.' is used instead of '->'
m_text = trimmedText.leftRef(trimmedText.size() - 1) + QStringLiteral("->"); m_text = trimmedText.leftRef(trimmedText.size() - 1) + QLatin1String("->");
CXUnsavedFile unsaved; CXUnsavedFile unsaved;
unsaved.Filename = file.constData(); unsaved.Filename = file.constData();
......
...@@ -153,22 +153,18 @@ QString SourceCodeInsertion::applySubScope(const QString& decl) const ...@@ -153,22 +153,18 @@ QString SourceCodeInsertion::applySubScope(const QString& decl) const
return decl; return decl;
} }
QString scopeType = QStringLiteral("namespace"); const bool isClassContext = (m_context && m_context->type() == DUContext::Class);
QString scopeClose; const QLatin1String scopeType = isClassContext ? QLatin1String("struct ") : QLatin1String("namespace ");
const QLatin1String scopeClose = isClassContext ? QLatin1String(";") : QLatin1String("");
if (m_context && m_context->type() == DUContext::Class) {
scopeType = QStringLiteral("struct");
scopeClose = QStringLiteral(";");
}
QString ret; QString ret;
const auto scopes = m_scope.toStringList(); const auto scopes = m_scope.toStringList();
for (const QString& scope : scopes) { for (const QString& scope : scopes) {
ret += scopeType + QLatin1Char(' ') + scope + QStringLiteral(" {\n"); ret += scopeType + scope + QLatin1String(" {\n");
} }
ret += decl; ret += decl;
ret += QLatin1Char('}') + scopeClose + QStringLiteral("\n").repeated(m_scope.count()); ret += QString(QLatin1Char('}') + scopeClose + QLatin1Char('\n')).repeated(m_scope.count());
return ret; return ret;
} }
...@@ -252,7 +248,7 @@ bool SourceCodeInsertion::insertFunctionDeclaration(KDevelop::Declaration* decla ...@@ -252,7 +248,7 @@ bool SourceCodeInsertion::insertFunctionDeclaration(KDevelop::Declaration* decla
int line = findInsertionPoint(); int line = findInsertionPoint();
decl = QStringLiteral("\n\n") + applySubScope(decl); decl = QLatin1String("\n\n") + applySubScope(decl);
const auto url = declaration->url().toUrl(); const auto url = declaration->url().toUrl();
QMimeDatabase db; QMimeDatabase db;
QMimeType mime = db.mimeTypeForUrl(url); QMimeType mime = db.mimeTypeForUrl(url);
......
...@@ -61,9 +61,7 @@ QSharedPointer<const ClangPCH> ClangIndex::pch(const ClangParsingEnvironment& en ...@@ -61,9 +61,7 @@ QSharedPointer<const ClangPCH> ClangIndex::pch(const ClangParsingEnvironment& en
UrlParseLock pchLock(IndexedString(pchInclude.pathOrUrl())); UrlParseLock pchLock(IndexedString(pchInclude.pathOrUrl()));
static const QString pchExt = QStringLiteral(".pch"); if (QFile::exists(pchInclude.toLocalFile() + QLatin1String(".pch"))) {
if (QFile::exists(pchInclude.toLocalFile() + pchExt)) {
QReadLocker lock(&m_pchLock); QReadLocker lock(&m_pchLock);
auto pch = m_pch.constFind(pchInclude); auto pch = m_pch.constFind(pchInclude);
if (pch != m_pch.constEnd()) { if (pch != m_pch.constEnd()) {
......
...@@ -228,7 +228,7 @@ bool checkForNeedingConfigure( KDevelop::IProject* project ) ...@@ -228,7 +228,7 @@ bool checkForNeedingConfigure( KDevelop::IProject* project )
}; };
if (!currentRuntime->buildPath().isEmpty()) { if (!currentRuntime->buildPath().isEmpty()) {
const Path newBuilddir(currentRuntime->buildPath(), QStringLiteral("build-") + currentRuntimeName + project->name()); const Path newBuilddir(currentRuntime->buildPath(), QLatin1String("build-") + currentRuntimeName + project->name());
const Path installPath(QString::fromUtf8(currentRuntime->getenv("KDEV_DEFAULT_INSTALL_PREFIX"))); const Path installPath(QString::fromUtf8(currentRuntime->getenv("KDEV_DEFAULT_INSTALL_PREFIX")));
addBuildDir(newBuilddir, installPath, {}, QStringLiteral("Debug"), {}); addBuildDir(newBuilddir, installPath, {}, QStringLiteral("Debug"), {});
......
...@@ -118,18 +118,18 @@ void CodeUtilsPlugin::documentDeclaration() ...@@ -118,18 +118,18 @@ void CodeUtilsPlugin::documentDeclaration()
lock.unlock(); lock.unlock();
// TODO: Choose the template based on the language // TODO: Choose the template based on the language
QString templateName = QStringLiteral("doxygen_cpp"); QLatin1String templateName = QLatin1String("doxygen_cpp");
auto languages = core()->languageController()->languagesForUrl(view->document()->url()); auto languages = core()->languageController()->languagesForUrl(view->document()->url());
if (!languages.isEmpty()) if (!languages.isEmpty())
{ {
QString languageName = languages.first()->name(); QString languageName = languages.first()->name();
if (languageName == QLatin1String("Php")) if (languageName == QLatin1String("Php"))
{ {
templateName = QStringLiteral("phpdoc_php"); templateName = QLatin1String("phpdoc_php");
} }
else if (languageName == QLatin1String("Python")) else if (languageName == QLatin1String("Python"))
{ {
templateName = QStringLiteral("rest_python"); templateName = QLatin1String("rest_python");
// Python docstrings appear inside functions and classes, not above them // Python docstrings appear inside functions and classes, not above them
insertPos = Cursor(line+1, 0); insertPos = Cursor(line+1, 0);
} }
......
...@@ -199,7 +199,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const ...@@ -199,7 +199,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const
auto match = mocHeaderRegex.match(QString::fromUtf8(qtHeader.readLine())); auto match = mocHeaderRegex.match(QString::fromUtf8(qtHeader.readLine()));
if (match.hasMatch()) { if (match.hasMatch()) {
mocDefineFound = true; mocDefineFound = true;
result << QStringLiteral("-DQ_MOC_OUTPUT_REVISION=") + match.captured(1); result << QLatin1String("-DQ_MOC_OUTPUT_REVISION=") + match.captured(1);
break; break;
} }
} }
...@@ -244,7 +244,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const ...@@ -244,7 +244,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const
if (m_project && m_project->managerPlugin()) { if (m_project && m_project->managerPlugin()) {
if (m_project->managerPlugin()->componentName() == QLatin1String("kdevcmakemanager")) { if (m_project->managerPlugin()->componentName() == QLatin1String("kdevcmakemanager")) {
result << QStringLiteral("-i") result << QStringLiteral("-i")
<< m_projectBuildPath.toLocalFile() + QStringLiteral("/CMakeFiles"); << m_projectBuildPath.toLocalFile() + QLatin1String("/CMakeFiles");
} }
} }
......
...@@ -109,7 +109,7 @@ void FlatpakPlugin::exportCurrent() ...@@ -109,7 +109,7 @@ void FlatpakPlugin::exportCurrent()
void FlatpakPlugin::createRuntime(const KDevelop::Path &file, const QString &arch) void FlatpakPlugin::createRuntime(const KDevelop::Path &file, const QString &arch)
{ {
QTemporaryDir* dir = new QTemporaryDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/kdevelop-flatpak-")); QTemporaryDir* dir = new QTemporaryDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/kdevelop-flatpak-"));
const KDevelop::Path path(dir->path()); const KDevelop::Path path(dir->path());
auto process = FlatpakRuntime::createBuildDirectory(path, file, arch); auto process = FlatpakRuntime::createBuildDirectory(path, file, arch);
......
...@@ -42,11 +42,11 @@ Visualizer::Visualizer(const QString& resultsFile, QObject* parent) ...@@ -42,11 +42,11 @@ Visualizer::Visualizer(const QString& resultsFile, QObject* parent)
QString errorMessage; QString errorMessage;
if (error == QProcess::FailedToStart) { if (error == QProcess::FailedToStart) {
errorMessage = i18n("Failed to start visualizer from \"%1\".", program()) errorMessage = i18n("Failed to start visualizer from \"%1\".", program())
+ QStringLiteral("\n\n") + QLatin1String("\n\n")
+ i18n("Check your settings and install the visualizer if necessary."); + i18n("Check your settings and install the visualizer if necessary.");
} else { } else {
errorMessage = i18n("Error during visualizer execution:") errorMessage = i18n("Error during visualizer execution:")
+ QStringLiteral("\n\n") + QLatin1String("\n\n")
+ errorString(); + errorString();
} }
KMessageBox::error(activeMainWindow(), errorMessage, i18n("Heaptrack Error")); KMessageBox::error(activeMainWindow(), errorMessage, i18n("Heaptrack Error"));
......
...@@ -107,7 +107,7 @@ OutlineNode::OutlineNode(Declaration* decl, OutlineNode* parent) ...@@ -107,7 +107,7 @@ OutlineNode::OutlineNode(Declaration* decl, OutlineNode* parent)
if (first) { if (first) {
first = false; first = false;
} else { } else {
m_cachedText += QStringLiteral(", "); m_cachedText += QLatin1String(", ");
} }
if (childDecl->abstractType()) { if (childDecl->abstractType()) {
......
...@@ -65,7 +65,7 @@ QString descriptionFromProblem(IProblem::Ptr problem) ...@@ -65,7 +65,7 @@ QString descriptionFromProblem(IProblem::Ptr problem)
text += QLatin1Char(':') + QString::number(location.start().column() + 1); text += QLatin1Char(':') + QString::number(location.start().column() + 1);
} }
} }
text += QStringLiteral(": "); text += QLatin1String(": ");
} }
text += problem->description(); text += problem->description();
if (!problem->explanation().isEmpty()) { if (!problem->explanation().isEmpty()) {
......
...@@ -90,7 +90,7 @@ void QmlJS::ModuleCompletionItem::execute(KTextEditor::View* view, const KTextEd ...@@ -90,7 +90,7 @@ void QmlJS::ModuleCompletionItem::execute(KTextEditor::View* view, const KTextEd
// Replace the whole line with an import statement // Replace the whole line with an import statement
view->document()->replaceText( view->document()->replaceText(
KTextEditor::Range(word.start().line(), 0, word.start().line(), INT_MAX), KTextEditor::Range(word.start().line(), 0, word.start().line(), INT_MAX),
QStringLiteral("import %1").arg(m_name) QLatin1String("import ") + m_name
); );
break; break;
case Quotes: case Quotes:
......
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