Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

kdevplatform/language: use QLatin1String overload for string concat

GIT_SILENT
parent 089d0c88
......@@ -68,7 +68,7 @@ const bool separateThreadForHighPriority = true;
*/
QString elidedPathLeft(const QString& path, int width)
{
static const QString placeholder = QStringLiteral("...");
const QLatin1String placeholder("...");
if (path.size() <= width) {
return path;
......@@ -82,8 +82,7 @@ QString elidedPathLeft(const QString& path, int width)
Q_ASSERT(path.size() - pos >= 0 && path.size() - pos <= width);
QStringRef elidedText = path.rightRef(path.size() - pos);
QString result = placeholder;
result.append(elidedText);
const QString result = placeholder + elidedText;
return result;
}
......
......@@ -1231,7 +1231,7 @@ extern void initInstantiationInformationRepository();
QString DUChain::repositoryPathForSession(const KDevelop::ISessionLock::Ptr& session)
{
QString cacheDir = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
cacheDir += QStringLiteral("/kdevduchain");
cacheDir += QLatin1String("/kdevduchain");
QString baseDir = QProcessEnvironment::systemEnvironment().value(QStringLiteral("KDEV_DUCHAIN_DIR"), cacheDir);
baseDir += QStringLiteral("/%1-%2").arg(qApp->applicationName(), session->id());
return baseDir;
......
......@@ -602,7 +602,7 @@ QString Identifier::toString(IdentifierStringFormattingOptions options) const
templateIds.append(templateIdentifier(i).toString(options));
}
ret += QStringLiteral("< ") + templateIds.join(QStringLiteral(", ")) + QStringLiteral(" >");
ret += QLatin1String("< ") + templateIds.join(QLatin1String(", ")) + QLatin1String(" >");
}
return ret;
......
......@@ -747,7 +747,7 @@ QString AbstractDeclarationNavigationContext::identifierHighlight(const QString&
}
if (decl->isDeprecated()) {
ret = QStringLiteral("<i>") + ret + QStringLiteral("</i>");
ret = QLatin1String("<i>") + ret + QLatin1String("</i>");
}
return ret;
}
......@@ -896,7 +896,7 @@ QString AbstractDeclarationNavigationContext::declarationSizeInformation(const D
sizeInfo += i18n("aligned to: %1 Bytes", memberDecl->alignOf());
}
sizeInfo += QStringLiteral("</p>");
sizeInfo += QLatin1String("</p>");
return sizeInfo;
}
......
......@@ -579,7 +579,7 @@ void AbstractNavigationContext::addHtml(const QString& html)
if (line.indexOf(newLineRegExp) != -1) {
++d->m_currentLine;
if (d->m_currentLine == d->m_currentPositionLine) {
d->m_currentText += QStringLiteral(
d->m_currentText += QLatin1String(
"<font color=\"#880088\"> <a name = \"currentPosition\" >&lt;-&gt;</a> </font>"); // >&lt;-&gt; is <->
}
}
......
......@@ -139,7 +139,7 @@ OneUseWidget::OneUseWidget(IndexedDeclaration declaration, const IndexedString&
DUChainReadLocker lock(DUChain::lock());
QString text = QLatin1String("<a>") + i18nc("refers to a line in source code", "Line <b>%1</b>:",
range.start().line()) + QStringLiteral("</a>");
range.start().line()) + QLatin1String("</a>");
if (!m_sourceLine.isEmpty() && m_sourceLine.length() > m_range->range().end().column()) {
text += QLatin1String("&nbsp;&nbsp;") + highlightAndEscapeUseText(m_sourceLine, 0, m_range->range());
......@@ -151,15 +151,15 @@ OneUseWidget::OneUseWidget(IndexedDeclaration declaration, const IndexedString&
for (int a = start; a < end; ++a) {
QString lineText = code.line(a).toHtmlEscaped();
if (m_range->range().start().line() <= a && m_range->range().end().line() >= a) {
lineText = QStringLiteral("<b>") + lineText + QStringLiteral("</b>");
lineText = QLatin1String("<b>") + lineText + QLatin1String("</b>");
}
if (!lineText.trimmed().isEmpty()) {
toolTipLines.append(lineText);
}
}
setToolTip(QStringLiteral("<html><body><pre>") + toolTipLines.join(QLatin1String("<br>")) +
QStringLiteral("</pre></body></html>"));
setToolTip(QLatin1String("<html><body><pre>") + toolTipLines.join(QLatin1String("<br>")) +
QLatin1String("</pre></body></html>"));
}
m_label->setText(text);
......@@ -218,16 +218,16 @@ void OneUseWidget::resizeEvent(QResizeEvent* event)
int maxCutOff = m_sourceLine.length() - (range.end().column() - range.start().column());
//Reset so we also get more context while up-sizing
m_label->setText(QStringLiteral("<a>") +
m_label->setText(QLatin1String("<a>") +
i18nc("Refers to a line in source code", "Line <b>%1</b>:", range.start().line() + 1)
+ QStringLiteral("</a> ") + highlightAndEscapeUseText(m_sourceLine, cutOff, range));
+ QLatin1String("</a> ") + highlightAndEscapeUseText(m_sourceLine, cutOff, range));
/// FIXME: this is incredibly ugly and slow... we could simply paint the text ourselves and elide it properly
while (sizeHint().width() > size.width() && cutOff < maxCutOff) {
//We've got to save space
m_label->setText(QStringLiteral("<a>") +
m_label->setText(QLatin1String("<a>") +
i18nc("Refers to a line in source code", "Line <b>%1</b>:", range.start().line() + 1)
+ QStringLiteral("</a> ") + highlightAndEscapeUseText(m_sourceLine, cutOff, range));
+ QLatin1String("</a> ") + highlightAndEscapeUseText(m_sourceLine, cutOff, range));
cutOff += 5;
}
......
......@@ -91,7 +91,7 @@ void PointerType::setBaseType(const AbstractType::Ptr& type)
QString PointerType::toString() const
{
QString baseString = (baseType() ? baseType()->toString() : QStringLiteral("<notype>"));
return QStringLiteral("%1*").arg(baseString) + AbstractType::toString(true);
return baseString + QLatin1Char('*') + AbstractType::toString(true);
}
AbstractType::WhichType PointerType::whichType() const
......
......@@ -104,7 +104,7 @@ QString ReferenceType::toString() const
{
AbstractType::Ptr base = baseType();
QString baseString = (base ? base->toString() : QStringLiteral("<notype>"));
const QString ampersands = d_func()->m_isRValue ? QStringLiteral("&&") : QStringLiteral("&");
const QLatin1String ampersands = d_func()->m_isRValue ? QLatin1String("&&") : QLatin1String("&");
if (base.cast<IntegralType>() || base.cast<StructureType>())
return AbstractType::toString(false) + baseString + ampersands;
else
......
......@@ -82,9 +82,7 @@ QString StructureType::toString() const
return AbstractType::toString() + id.toString();
}
QString type = QStringLiteral("class");
return QStringLiteral("<%1>").arg(type) + AbstractType::toString(true);
return QLatin1String("<class>") + AbstractType::toString(true);
}
AbstractType::WhichType StructureType::whichType() const
......
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