Use QLatin1String overload for string concat

GIT_SILENT
parent 21caef57
......@@ -309,7 +309,7 @@ void OutputExecuteJob::start()
} else {
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 {
QString errorMessage = i18n("Failed to specify program to start: %1", d->joinCommandLine());
model()->appendLine( i18n( "*** %1 ***", errorMessage) );
......
......@@ -1003,7 +1003,7 @@ QString DocumentController::activeDocumentPath( const QString& target ) const
{
QString ret = static_cast<ProjectItemContext*>(selection)->items().at(0)->path().pathOrUrl();
if(static_cast<ProjectItemContext*>(selection)->items().at(0)->folder())
ret += QStringLiteral("/.");
ret += QLatin1String("/.");
return ret;
}
return QString();
......
......@@ -44,7 +44,7 @@ QString dBusServiceNameForSession( const QString& id )
{
// We remove starting "{" and ending "}" from the string UUID representation
// 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.
......
......@@ -437,14 +437,15 @@ QString SourceFormatterController::addModelineForCurrentLang(QString input, cons
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
modeline.append(QStringLiteral("indent-width %1; ").arg(indentation.indentWidth));
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)
modeline.append(QStringLiteral("tab-width %1; ").arg(indentation.indentationTabWidth));
}
......
......@@ -141,7 +141,7 @@ QString qvariantToString(const QVariant& 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;
}
......
......@@ -54,7 +54,7 @@ QString BazaarUtils::getRevisionSpec(const KDevelop::VcsRevision& revision)
else
return QString(); // Don't know how to handle this situation
} else if (revision.revisionType() == KDevelop::VcsRevision::GlobalNumber)
return QStringLiteral("-r") + QString::number(revision.revisionValue().toLongLong());
return QLatin1String("-r") + QString::number(revision.revisionValue().toLongLong());
else
return QString(); // Don't know how to handle this situation
}
......@@ -107,9 +107,9 @@ QString BazaarUtils::getRevisionSpecRange(const KDevelop::VcsRevision& begin,
} else if (begin.revisionType() == KDevelop::VcsRevision::GlobalNumber) {
if (end.revisionType() == KDevelop::VcsRevision::Special) {
// Assuming working copy
return QStringLiteral("-r") + QString::number(begin.revisionValue().toLongLong());
return QLatin1String("-r") + QString::number(begin.revisionValue().toLongLong());
} else {
return QStringLiteral("-r") + QString::number(begin.revisionValue().toLongLong())
return QLatin1String("-r") + QString::number(begin.revisionValue().toLongLong())
+ QLatin1String("..") + QString::number(end.revisionValue().toLongLong());
}
}
......
......@@ -738,8 +738,8 @@ public:
auto decl = pair.first;
if (matchedTypes.contains(decl->indexedType())) {
auto parent = pair.second;
const QString access = parent->abstractType()->whichType() == AbstractType::TypePointer
? QStringLiteral("->") : QStringLiteral(".");
const QLatin1String access = (parent->abstractType()->whichType() == AbstractType::TypePointer)
? QLatin1String("->") : QLatin1String(".");
const QString text = parent->identifier().toString() + access + decl->identifier().toString();
auto item = new DeclarationItem(decl, text, {}, text);
item->setMatchQuality(8);
......@@ -943,7 +943,7 @@ ClangCodeCompletionContext::ClangCodeCompletionContext(const DUContextPointer& c
if (trimmedText.endsWith(QLatin1Char('.'))) {
// 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 '->'
m_text = trimmedText.leftRef(trimmedText.size() - 1) + QStringLiteral("->");
m_text = trimmedText.leftRef(trimmedText.size() - 1) + QLatin1String("->");
CXUnsavedFile unsaved;
unsaved.Filename = file.constData();
......
......@@ -153,22 +153,18 @@ QString SourceCodeInsertion::applySubScope(const QString& decl) const
return decl;
}
QString scopeType = QStringLiteral("namespace");
QString scopeClose;
if (m_context && m_context->type() == DUContext::Class) {
scopeType = QStringLiteral("struct");
scopeClose = QStringLiteral(";");
}
const bool isClassContext = (m_context && m_context->type() == DUContext::Class);
const QLatin1String scopeType = isClassContext ? QLatin1String("struct ") : QLatin1String("namespace ");
const QLatin1String scopeClose = isClassContext ? QLatin1String(";") : QLatin1String("");
QString ret;
const auto scopes = m_scope.toStringList();
for (const QString& scope : scopes) {
ret += scopeType + QLatin1Char(' ') + scope + QStringLiteral(" {\n");
ret += scopeType + scope + QLatin1String(" {\n");
}
ret += decl;
ret += QLatin1Char('}') + scopeClose + QStringLiteral("\n").repeated(m_scope.count());
ret += QString(QLatin1Char('}') + scopeClose + QLatin1Char('\n')).repeated(m_scope.count());
return ret;
}
......@@ -252,7 +248,7 @@ bool SourceCodeInsertion::insertFunctionDeclaration(KDevelop::Declaration* decla
int line = findInsertionPoint();
decl = QStringLiteral("\n\n") + applySubScope(decl);
decl = QLatin1String("\n\n") + applySubScope(decl);
const auto url = declaration->url().toUrl();
QMimeDatabase db;
QMimeType mime = db.mimeTypeForUrl(url);
......
......@@ -61,9 +61,7 @@ QSharedPointer<const ClangPCH> ClangIndex::pch(const ClangParsingEnvironment& en
UrlParseLock pchLock(IndexedString(pchInclude.pathOrUrl()));
static const QString pchExt = QStringLiteral(".pch");
if (QFile::exists(pchInclude.toLocalFile() + pchExt)) {
if (QFile::exists(pchInclude.toLocalFile() + QLatin1String(".pch"))) {
QReadLocker lock(&m_pchLock);
auto pch = m_pch.constFind(pchInclude);
if (pch != m_pch.constEnd()) {
......
......@@ -228,7 +228,7 @@ bool checkForNeedingConfigure( KDevelop::IProject* project )
};
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")));
addBuildDir(newBuilddir, installPath, {}, QStringLiteral("Debug"), {});
......
......@@ -118,18 +118,18 @@ void CodeUtilsPlugin::documentDeclaration()
lock.unlock();
// 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());
if (!languages.isEmpty())
{
QString languageName = languages.first()->name();
if (languageName == QLatin1String("Php"))
{
templateName = QStringLiteral("phpdoc_php");
templateName = QLatin1String("phpdoc_php");
}
else if (languageName == QLatin1String("Python"))
{
templateName = QStringLiteral("rest_python");
templateName = QLatin1String("rest_python");
// Python docstrings appear inside functions and classes, not above them
insertPos = Cursor(line+1, 0);
}
......
......@@ -199,7 +199,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const
auto match = mocHeaderRegex.match(QString::fromUtf8(qtHeader.readLine()));
if (match.hasMatch()) {
mocDefineFound = true;
result << QStringLiteral("-DQ_MOC_OUTPUT_REVISION=") + match.captured(1);
result << QLatin1String("-DQ_MOC_OUTPUT_REVISION=") + match.captured(1);
break;
}
}
......@@ -244,7 +244,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const
if (m_project && m_project->managerPlugin()) {
if (m_project->managerPlugin()->componentName() == QLatin1String("kdevcmakemanager")) {
result << QStringLiteral("-i")
<< m_projectBuildPath.toLocalFile() + QStringLiteral("/CMakeFiles");
<< m_projectBuildPath.toLocalFile() + QLatin1String("/CMakeFiles");
}
}
......
......@@ -109,7 +109,7 @@ void FlatpakPlugin::exportCurrent()
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());
auto process = FlatpakRuntime::createBuildDirectory(path, file, arch);
......
......@@ -42,11 +42,11 @@ Visualizer::Visualizer(const QString& resultsFile, QObject* parent)
QString errorMessage;
if (error == QProcess::FailedToStart) {
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.");
} else {
errorMessage = i18n("Error during visualizer execution:")
+ QStringLiteral("\n\n")
+ QLatin1String("\n\n")
+ errorString();
}
KMessageBox::error(activeMainWindow(), errorMessage, i18n("Heaptrack Error"));
......
......@@ -107,7 +107,7 @@ OutlineNode::OutlineNode(Declaration* decl, OutlineNode* parent)
if (first) {
first = false;
} else {
m_cachedText += QStringLiteral(", ");
m_cachedText += QLatin1String(", ");
}
if (childDecl->abstractType()) {
......
......@@ -65,7 +65,7 @@ QString descriptionFromProblem(IProblem::Ptr problem)
text += QLatin1Char(':') + QString::number(location.start().column() + 1);
}
}
text += QStringLiteral(": ");
text += QLatin1String(": ");
}
text += problem->description();
if (!problem->explanation().isEmpty()) {
......
......@@ -90,7 +90,7 @@ void QmlJS::ModuleCompletionItem::execute(KTextEditor::View* view, const KTextEd
// Replace the whole line with an import statement
view->document()->replaceText(
KTextEditor::Range(word.start().line(), 0, word.start().line(), INT_MAX),
QStringLiteral("import %1").arg(m_name)
QLatin1String("import ") + m_name
);
break;
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