Commit e2584f69 authored by Kai Koehne's avatar Kai Koehne Committed by hjk

Replace QLatin1String("x") with QLatin1Char('x') where possible

Change-Id: I2f90c8ae7b5e968b9de882833f8661ab540a9232
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent d4a7505a
......@@ -125,43 +125,43 @@ void NamePrettyPrinter::visit(const OperatorNameId *name)
_name += QLatin1String("delete[]");
break;
case OperatorNameId::PlusOp:
_name += QLatin1String("+");
_name += QLatin1Char('+');
break;
case OperatorNameId::MinusOp:
_name += QLatin1String("-");
_name += QLatin1Char('-');
break;
case OperatorNameId::StarOp:
_name += QLatin1String("*");
_name += QLatin1Char('*');
break;
case OperatorNameId::SlashOp:
_name += QLatin1String("/");
_name += QLatin1Char('/');
break;
case OperatorNameId::PercentOp:
_name += QLatin1String("%");
_name += QLatin1Char('%');
break;
case OperatorNameId::CaretOp:
_name += QLatin1String("^");
_name += QLatin1Char('^');
break;
case OperatorNameId::AmpOp:
_name += QLatin1String("&");
_name += QLatin1Char('&');
break;
case OperatorNameId::PipeOp:
_name += QLatin1String("|");
_name += QLatin1Char('|');
break;
case OperatorNameId::TildeOp:
_name += QLatin1String("~");
_name += QLatin1Char('~');
break;
case OperatorNameId::ExclaimOp:
_name += QLatin1String("!");
_name += QLatin1Char('!');
break;
case OperatorNameId::EqualOp:
_name += QLatin1String("=");
_name += QLatin1Char('=');
break;
case OperatorNameId::LessOp:
_name += QLatin1String("<");
_name += QLatin1Char('<');
break;
case OperatorNameId::GreaterOp:
_name += QLatin1String(">");
_name += QLatin1Char('>');
break;
case OperatorNameId::PlusEqualOp:
_name += QLatin1String("+=");
......@@ -224,7 +224,7 @@ void NamePrettyPrinter::visit(const OperatorNameId *name)
_name += QLatin1String("--");
break;
case OperatorNameId::CommaOp:
_name += QLatin1String(",");
_name += QLatin1Char(',');
break;
case OperatorNameId::ArrowStarOp:
_name += QLatin1String("->*");
......
......@@ -320,7 +320,7 @@ void TypePrettyPrinter::prependSpaceBeforeIndirection(const FullySpecifiedType &
const bool elementIsConstPointerOrReference = elementTypeIsPointerOrReference && type.isConst();
const bool shouldBindToLeftSpecifier = _overview->starBindFlags & Overview::BindToLeftSpecifier;
if (elementIsConstPointerOrReference && ! shouldBindToLeftSpecifier)
_text.prepend(QLatin1String(" "));
_text.prepend(QLatin1Char(' '));
}
void TypePrettyPrinter::prependSpaceAfterIndirection(bool hasName)
......@@ -340,7 +340,7 @@ void TypePrettyPrinter::prependSpaceAfterIndirection(bool hasName)
const bool case3 = ! hasCvSpecifier && ! shouldBindToIdentifier
&& ! _isIndirectionToArrayOrFunction && _text.size() && _text.at(0).isLetter();
if (case1 || case2 || case3)
_text.prepend(QLatin1String(" "));
_text.prepend(QLatin1Char(' '));
}
void TypePrettyPrinter::visit(PointerType *type)
......
......@@ -95,7 +95,7 @@ QString FakeMetaEnum::describe(int baseIndent) const
res += QString::number(m_values.value(i, -1));
}
res += newLine;
res += QLatin1String("}");
res += QLatin1Char('}');
return res;
}
......@@ -195,7 +195,7 @@ QString FakeMetaMethod::describe(int baseIndent) const
res += QLatin1String(" ");
res += pName;
}
res += QLatin1String("]");
res += QLatin1Char(']');
res += newLine;
res += QLatin1String(" parameterTypes:[");
foreach (const QString &pType, parameterTypes()) {
......@@ -203,9 +203,9 @@ QString FakeMetaMethod::describe(int baseIndent) const
res += QLatin1String(" ");
res += pType;
}
res += QLatin1String("]");
res += QLatin1Char(']');
res += newLine;
res += QLatin1String("}");
res += QLatin1Char('}');
return res;
}
......@@ -281,7 +281,7 @@ QString FakeMetaProperty::describe(int baseIndent) const
res += QLatin1String(" isWritable:");
res += isWritable();
res += newLine;
res += QLatin1String("}");
res += QLatin1Char('}');
return res;
}
......@@ -485,7 +485,7 @@ QString FakeMetaObject::describe(bool printDetails, int baseIndent) const
if (!printDetails)
return res;
QString newLine = QString::fromLatin1("\n") + QString::fromLatin1(" ").repeated(baseIndent);
res += QLatin1String("{");
res += QLatin1Char('{');
res += newLine;
res += QLatin1String("className:");
res += className();
......@@ -518,7 +518,7 @@ QString FakeMetaObject::describe(bool printDetails, int baseIndent) const
res += QLatin1String(" ");
res += e.describe(baseIndent + 2);
}
res += QLatin1String("]");
res += QLatin1Char(']');
res += newLine;
res += QLatin1String("enums:[");
......@@ -528,7 +528,7 @@ QString FakeMetaObject::describe(bool printDetails, int baseIndent) const
res += QLatin1String(" ");
res += e.describe(baseIndent + 2);
}
res += QLatin1String("]");
res += QLatin1Char(']');
res += newLine;
res += QLatin1String("properties:[");
......@@ -538,7 +538,7 @@ QString FakeMetaObject::describe(bool printDetails, int baseIndent) const
res += QLatin1String(" ");
res += prop.describe(baseIndent + 2);
}
res += QLatin1String("]");
res += QLatin1Char(']');
res += QLatin1String("methods:[");
for (int iMethod = 0; iMethod < methodOffset() ; ++ iMethod) {
FakeMetaMethod m = method(methodOffset() + iMethod);
......@@ -546,9 +546,9 @@ QString FakeMetaObject::describe(bool printDetails, int baseIndent) const
res += QLatin1String(" ");
m.describe(baseIndent + 2);
}
res += QLatin1String("]");
res += QLatin1Char(']');
res += newLine;
res += QLatin1String("}");
res += QLatin1Char('}');
return res;
}
......@@ -590,7 +590,7 @@ QString FakeMetaObject::Export::describe(int baseIndent) const
res += QLatin1String(" isValid:");
res += QString::number(isValid());
res += newLine;
res += QLatin1String("}");
res += QLatin1Char('}');
return res;
}
......
......@@ -266,7 +266,7 @@ void ContextPaneWidgetRectangle::timerEvent(QTimerEvent *event)
str += QLatin1String("color: ") + QLatin1String("\"") + stop.second.name() + QLatin1String("\";\n");
str += QLatin1String("}\n");
}
str += QLatin1String("}");
str += QLatin1Char('}');
emit propertyChanged(QLatin1String("gradient"), str);
}
}
......
......@@ -379,7 +379,7 @@ int QmlJSIndenter::indentForContinuationLine()
*/
if (!isContinuationLine())
return indentOfLine(*yyLine);
} else if (isContinuationLine() || yyLine->endsWith(QLatin1String(","))) {
} else if (isContinuationLine() || yyLine->endsWith(QLatin1Char(','))) {
/*
We have
......
......@@ -200,25 +200,25 @@ QString PropertyInfo::toString() const
}
if (isWriteable()) {
if (join)
res += QLatin1String("|");
res += QLatin1Char('|');
res += QLatin1String("Writeable");
join = true;
}
if (isList()) {
if (join)
res += QLatin1String("|");
res += QLatin1Char('|');
res += QLatin1String("ListType");
join = true;
}
if (canBePointer()) {
if (join)
res += QLatin1String("|");
res += QLatin1Char('|');
res += QLatin1String("Pointer");
join = true;
}
if (canBeValue()) {
if (join)
res += QLatin1String("|");
res += QLatin1Char('|');
res += QLatin1String("Value");
join = true;
}
......
......@@ -563,7 +563,7 @@ bool LineInfo::isUnfinishedLine()
unf = true;
// ### This only checks one line back.
} else if (readLine() && yyLine->endsWith(QLatin1String(";")) && hasUnclosedParenOrBracket()) {
} else if (readLine() && yyLine->endsWith(QLatin1Char(';')) && hasUnclosedParenOrBracket()) {
/*
Exception:
......
......@@ -324,7 +324,7 @@ void PluginDumper::qmlPluginTypeDumpDone(int exitCode)
CppQmlTypesLoader::BuiltinObjects objectsList;
QList<ModuleApiInfo> moduleApis;
CppQmlTypesLoader::parseQmlTypeDescriptions(output, &objectsList, &moduleApis, &error, &warning,
QLatin1String("<dump of ") + libraryPath + QLatin1String(">"));
QLatin1String("<dump of ") + libraryPath + QLatin1Char('>'));
if (exitCode == 0) {
if (!error.isEmpty()) {
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError,
......
......@@ -119,7 +119,7 @@ QString QrcParser::normalizedQrcFilePath(const QString &path) {
while (endPrefix + 1 < path.size() && path.at(endPrefix+1) == QLatin1Char('/'))
++endPrefix;
normPath = path.right(path.size()-endPrefix);
if (!normPath.startsWith(QLatin1String("/")))
if (!normPath.startsWith(QLatin1Char('/')))
normPath.insert(0, QLatin1Char('/'));
return normPath;
}
......
......@@ -99,7 +99,7 @@ SftpFileSystemModel::SftpFileSystemModel(QObject *parent)
: QAbstractItemModel(parent), d(new SftpFileSystemModelPrivate)
{
d->sshConnection = 0;
d->rootDirectory = QLatin1String("/");
d->rootDirectory = QLatin1Char('/');
d->rootNode = 0;
d->statJobId = SftpInvalidJob;
}
......
......@@ -172,7 +172,7 @@ bool FileNameValidatingLineEdit::validateFileNameExtension(const QString &fileNa
// file extension
if (!requiredExtensions.isEmpty()) {
foreach (const QString &requiredExtension, requiredExtensions) {
QString extension = QLatin1String(".") + requiredExtension;
QString extension = QLatin1Char('.') + requiredExtension;
if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.count() < fileName.count())
return true;
}
......
......@@ -70,7 +70,7 @@ struct NewClassWidgetPrivate {
};
NewClassWidgetPrivate:: NewClassWidgetPrivate() :
m_headerExtension(QLatin1String("h")),
m_headerExtension(QLatin1Char('h')),
m_sourceExtension(QLatin1String("cpp")),
m_formExtension(QLatin1String("ui")),
m_valid(false),
......
......@@ -46,7 +46,7 @@ void CommentDefinition::setStyle(Style style)
multiLineEnd = QLatin1String("*/");
break;
case HashStyle:
singleLine = QLatin1String("#");
singleLine = QLatin1Char('#');
multiLineStart.clear();
multiLineEnd.clear();
break;
......
......@@ -1250,7 +1250,7 @@ void AndroidConfigurations::load()
int major = -1;
int minor = -1;
foreach (const QString &version, allVersions) {
QStringList parts = version.split(QLatin1String("."));
QStringList parts = version.split(QLatin1Char('.'));
if (parts.size() != 2) // not interested in 1.7.0_u21
continue;
bool okMajor, okMinor;
......
......@@ -260,7 +260,7 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
m_ndkState = Error;
m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.")
.arg(m_androidConfig.ndkLocation().toUserOutput());
} else if (platformPath.toString().contains(QLatin1String(" "))) {
} else if (platformPath.toString().contains(QLatin1Char(' '))) {
m_ndkState = Error;
m_ndkErrorMessage = tr("The Android NDK cannot be installed into a path with spaces.");
} else {
......
......@@ -102,7 +102,7 @@ DebuggerStartParameters BareMetalRunControlFactory::startParameters(const BareMe
if (device->sshParameters().host.startsWith(QLatin1Char('|'))) //gdb pipe mode enabled
params.remoteChannel = device->sshParameters().host;
else
params.remoteChannel = device->sshParameters().host + QLatin1String(":") + QString::number(device->sshParameters().port);
params.remoteChannel = device->sshParameters().host + QLatin1Char(':') + QString::number(device->sshParameters().port);
params.remoteSetupNeeded = false; // qml stuff, not needed
params.commandsAfterConnect = device->gdbInitCommands().toLatin1();
params.commandsForReset = device->gdbResetCommands().toLatin1();
......
......@@ -138,7 +138,7 @@ Command ClangFormat::command(int offset, int length) const
} else {
command.addOption(QLatin1String("-style={")
+ m_settings->style(m_settings->customStyle()).remove(QLatin1Char('\n'))
+ QLatin1String("}"));
+ QLatin1Char('}'));
}
if (offset != -1) {
......
......@@ -383,7 +383,7 @@ void CompletionProposalsBuilder::concatChunksForObjectiveCMessage(const CXComple
}
const QString text = Internal::getQString(clang_getCompletionChunkText(cxString, index), false);
if (chunkKind == CXCompletionChunk_ResultType) {
hintPrefix += QLatin1String("(");
hintPrefix += QLatin1Char('(');
hintPrefix += text.toHtmlEscaped();
hintPrefix += QLatin1String(") ");
indentBonus += 3 + text.length();
......
......@@ -294,7 +294,7 @@ void CXPrettyPrinter::writeCompletionContexts(CXCodeCompleteResults *results)
foreach (const QString &line, lines) {
writeLineEnd();
m_printed += line + QLatin1String(",");
m_printed += line + QLatin1Char(',');
}
}
......@@ -381,7 +381,7 @@ void CXPrettyPrinter::writeCompletionAnnotationJson(const CXCompletionString &st
void CXPrettyPrinter::writeDiagnosticJson(const CXDiagnostic &diag)
{
m_printed += QLatin1String("{");
m_printed += QLatin1Char('{');
m_indent += 4;
writeLineEnd();
......@@ -410,7 +410,7 @@ void CXPrettyPrinter::writeDiagnosticJson(const CXDiagnostic &diag)
writeFixItJson(diag, i);
writeLineEnd();
}
m_printed += QLatin1String("]");
m_printed += QLatin1Char(']');
writeLineEnd();
}
......@@ -448,7 +448,7 @@ void CXPrettyPrinter::writeDiagnosticJson(const CXDiagnostic &diag)
}
m_indent -= 4;
writeLineEnd();
m_printed += QLatin1String("]");
m_printed += QLatin1Char(']');
}
// children
......@@ -465,12 +465,12 @@ void CXPrettyPrinter::writeDiagnosticJson(const CXDiagnostic &diag)
}
m_indent -= 4;
writeLineEnd();
m_printed += QLatin1String("]");
m_printed += QLatin1Char(']');
}
m_indent -= 4;
writeLineEnd();
m_printed += QLatin1String("}");
m_printed += QLatin1Char('}');
}
void CXPrettyPrinter::writeFixItJson(const CXDiagnostic &diag, unsigned i)
......@@ -483,7 +483,7 @@ void CXPrettyPrinter::writeFixItJson(const CXDiagnostic &diag, unsigned i)
m_printed += text;
m_printed += QLatin1String("\', range: ");
writeRangeJson(range);
m_printed += QLatin1String("}");
m_printed += QLatin1Char('}');
}
void CXPrettyPrinter::writeRangeJson(const CXSourceRange &range)
......@@ -531,7 +531,7 @@ void CXPrettyPrinter::writeLocationJson(const CXSourceLocation &location)
m_printed += QLatin1String("line: ");
m_printed += QString::number(loc.line());
m_printed += QLatin1String(",");
m_printed += QLatin1Char(',');
writeLineEnd();
m_printed += QLatin1String("column: ");
......@@ -539,7 +539,7 @@ void CXPrettyPrinter::writeLocationJson(const CXSourceLocation &location)
m_indent -= 4;
writeLineEnd();
m_printed += QLatin1String("}");
m_printed += QLatin1Char('}');
}
void CXPrettyPrinter::writeLineEnd()
......
......@@ -96,7 +96,7 @@ QVariant TreeItemModel::data(const QModelIndex &index, int role) const
QString name(inf.name());
if (!inf.type().isEmpty())
name += QLatin1String(" ") + inf.type();
name += QLatin1Char(' ') + inf.type();
return name;
}
......
......@@ -403,7 +403,7 @@ QString ClearCasePlugin::ccViewRoot(const QString &directory) const
if (HostOsInfo::isWindowsHost())
root = getDriveLetterOfPath(directory);
else
root = QLatin1String("/");
root = QLatin1Char('/');
}
return QDir::fromNativeSeparators(root);
......
......@@ -100,7 +100,7 @@ bool PatchTool::runPatch(const QByteArray &input, const QString &workingDirector
args << QLatin1String("-R");
MessageManager::write(QApplication::translate("Core::PatchTool", "Executing in %1: %2 %3").
arg(QDir::toNativeSeparators(workingDirectory),
QDir::toNativeSeparators(patch), args.join(QLatin1String(" "))));
QDir::toNativeSeparators(patch), args.join(QLatin1Char(' '))));
patchProcess.start(patch, args);
if (!patchProcess.waitForStarted()) {
MessageManager::write(QApplication::translate("Core::PatchTool", "Unable to launch \"%1\": %2").arg(patch, patchProcess.errorString()));
......
......@@ -62,7 +62,7 @@ QString TestDataDir::directory(const QString &subdir, bool clean) const
{
QString path = m_directory;
if (!subdir.isEmpty())
path += QLatin1String("/") + subdir;
path += QLatin1Char('/') + subdir;
if (clean)
path = QDir::cleanPath(path);
maybeAppendSlash(&path);
......
......@@ -71,7 +71,7 @@ static QString getUserFilePath(const QString &proposalFileName)
if (!resourceDir.exists(QLatin1String("externaltools")))
resourceDir.mkpath(QLatin1String("externaltools"));
const QFileInfo fi(proposalFileName);
const QString &suffix = QLatin1String(".") + fi.completeSuffix();
const QString &suffix = QLatin1Char('.') + fi.completeSuffix();
const QString &newFilePath = ICore::userResourcePath()
+ QLatin1String("/externaltools/") + fi.baseName();
int count = 0;
......
......@@ -319,7 +319,7 @@ void VariableChooserPrivate::handleItemActivated(QListWidgetItem *item)
*/
void VariableChooserPrivate::insertVariable(const QString &variable)
{
const QString &text = QLatin1String("%{") + variable + QLatin1String("}");
const QString &text = QLatin1String("%{") + variable + QLatin1Char('}');
if (m_lineEdit) {
m_lineEdit->insert(text);
m_lineEdit->activateWindow();
......
......@@ -247,7 +247,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
// Make sure we an absolute path:
QString directory = QDir(inputDirectory).absolutePath();
#ifdef WITH_TESTS
if (directory[0].isLetter() && directory.indexOf(QLatin1String(":") + QLatin1String(TEST_PREFIX)) == 1)
if (directory[0].isLetter() && directory.indexOf(QLatin1Char(':') + QLatin1String(TEST_PREFIX)) == 1)
directory = directory.mid(2);
#endif
VcsManagerPrivate::VcsInfo *cachedData = d->findInCache(directory);
......@@ -634,7 +634,7 @@ void CorePlugin::testVcsManager()
foreach (const QString &result, results) {
// qDebug() << "Expecting:" << result;
QStringList split = result.split(QLatin1String(":"));
QStringList split = result.split(QLatin1Char(':'));
QCOMPARE(split.count(), 4);
QVERIFY(split.at(3) == QLatin1String("*") || split.at(3) == QLatin1String("-"));
......
......@@ -3165,7 +3165,7 @@ public:
if (m_funcReturn) {
funcDef.append(QLatin1String("\nreturn ")
+ m_relevantDecls.at(0).first
+ QLatin1String(";"));
+ QLatin1Char(';'));
funcCall.prepend(m_relevantDecls.at(0).second + QLatin1String(" = "));
}
funcDef.append(QLatin1String("\n}\n\n"));
......@@ -4537,7 +4537,7 @@ public:
} else {
QString textFuncDecl = fromFile->textOf(m_funcDef);
textFuncDecl.truncate(startPosition - fromFile->startOf(m_funcDef));
textFuncDecl = textFuncDecl.trimmed() + QLatin1String(";");
textFuncDecl = textFuncDecl.trimmed() + QLatin1Char(';');
headerTarget.replace(fromFile->range(m_funcDef), textFuncDecl);
}
fromFile->setChangeSet(headerTarget);
......
......@@ -162,7 +162,7 @@ QString CdbSymbolPathListEditor::symbolPath(const QString &cacheDir,
return QLatin1String(symbolCachePrefixC) + QDir::toNativeSeparators(cacheDir);
QString s = QLatin1String(symbolServerPrefixC);
if (!cacheDir.isEmpty())
s += QDir::toNativeSeparators(cacheDir) + QLatin1String("*");
s += QDir::toNativeSeparators(cacheDir) + QLatin1Char('*');
s += QLatin1String(symbolServerPostfixC);
return s;
}
......
......@@ -123,7 +123,7 @@ QString StackFrame::toToolTip() const
showDistributionNote = true;
}
if (!Utils::HostOsInfo::isWindowsHost() && showDistributionNote) {
str << QLatin1String(" ") <<
str << QLatin1Char(' ') <<
tr("Note that most distributions ship debug information "
"in separate packages.");
}
......
......@@ -185,7 +185,7 @@ bool GenericProject::addFiles(const QStringList &filePaths)
foreach (const QString &path, toAdd) {
QString relative = dir.relativeFilePath(path);
if (relative.isEmpty())
relative = QLatin1String(".");
relative = QLatin1Char('.');
m_rawProjectIncludePaths.append(relative);
}
......
......@@ -169,7 +169,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
if (! thisDir.entryList(nameFilters, QDir::Files).isEmpty()) {
QString relative = dir.relativeFilePath(path);
if (relative.isEmpty())
relative = QLatin1String(".");
relative = QLatin1Char('.');
includePaths.append(relative);
}
}
......
......@@ -193,7 +193,7 @@ void BranchDialog::checkout()
const QString currentBranch = m_model->fullName(m_model->currentBranch());
const QString nextBranch = m_model->fullName(idx);
const QString popMessageStart = QCoreApplication::applicationName() +
QLatin1String(" ") + nextBranch + QLatin1String("-AutoStash ");
QLatin1Char(' ') + nextBranch + QLatin1String("-AutoStash ");
BranchCheckoutDialog branchCheckoutDialog(this, currentBranch, nextBranch);
GitClient *gitClient = GitPlugin::instance()->gitClient();
......
......@@ -145,7 +145,7 @@ void GerritParameters::fromSettings(const QSettings *s)
port = s->value(rootKey + QLatin1String(portKeyC), QVariant(int(defaultPort))).toInt();
portFlag = s->value(rootKey + QLatin1String(portFlagKeyC), QLatin1String(defaultPortFlag)).toString();
savedQueries = s->value(rootKey + QLatin1String(savedQueriesKeyC), QString()).toString()
.split(QLatin1String(","));
.split(QLatin1Char(','));
https = s->value(rootKey + QLatin1String(httpsKeyC), QVariant(true)).toBool();
if (ssh.isEmpty())
ssh = detectSsh();
......
......@@ -526,7 +526,7 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch
QScopedPointer<QRegExp> branchRegexp;
if (!branch.isEmpty() && branch != QLatin1String("master")) {
QString branchPattern = branch;
branchPattern.replace(QLatin1String("."), QLatin1String("[\\.-_]?"));
branchPattern.replace(QLatin1Char('.'), QLatin1String("[\\.-_]?"));
const QString pattern = QLatin1Char('^') + project
+ QLatin1String("[-_]?")
+ branchPattern + QLatin1Char('$');
......
......@@ -138,7 +138,7 @@ bool RemoteHelpFilter::restoreState(const QByteArray &state)
QString value;
in >> value;
m_remoteUrls = value.split(QLatin1String("^"), QString::SkipEmptyParts);
m_remoteUrls = value.split(QLatin1Char('^'), QString::SkipEmptyParts);
QString shortcut;
in >> shortcut;
......
......@@ -165,7 +165,7 @@ void IosConfigurations::updateAutomaticKitList()