More explicit casting to/from QString/QChar

parent bff2b28a
......@@ -40,12 +40,12 @@ QString KDevIDEExtension::xmlFile()
QString KDevIDEExtension::executableFilePath()
{
return QApplication::applicationDirPath() + "/kdevelop";
return QApplication::applicationDirPath() + QLatin1String("/kdevelop");
}
KDevelop::AreaParams KDevIDEExtension::defaultArea()
{
KDevelop::AreaParams params = {"code", i18n("Code")};
KDevelop::AreaParams params = {QStringLiteral("code"), i18n("Code")};
return params;
}
......
......@@ -171,7 +171,13 @@ private Q_SLOTS:
const QString x11SessionId = sm.sessionId() + QLatin1Char('_') + sm.sessionKey();
QString kdevelopSessionId = activeSession->id().toString();
sm.setRestartCommand({QCoreApplication::applicationFilePath(), "-session", x11SessionId, "-s", kdevelopSessionId});
sm.setRestartCommand({
QCoreApplication::applicationFilePath(),
QStringLiteral("-session"),
x11SessionId,
QStringLiteral("-s"),
kdevelopSessionId
});
}
}
};
......@@ -293,7 +299,7 @@ static QString findSessionId(const SessionInfos& availableSessionInfos, const QS
} else if (projectAsSession.isEmpty()) {
foreach(const QUrl& k, si.projects) {
QString fn(k.fileName());
fn = fn.left(fn.indexOf('.'));
fn = fn.left(fn.indexOf(QLatin1Char('.')));
if ( session == fn ) {
projectAsSession = si.uuid.toString();
}
......@@ -364,14 +370,14 @@ int main( int argc, char *argv[] )
int c = argc;
for (int i=0; i < c; ++i) {
if (debugFound) {
debugArgs << argv[i];
debugArgs << QString::fromUtf8(argv[i]);
} else if ((qstrcmp(argv[i], "--debug") == 0) || (qstrcmp(argv[i], "-d") == 0)) {
if (argc > (i + 1)) {
i++;
}
argc = i + 1;
debugFound = true;
} else if (QString(argv[i]).startsWith(QLatin1String("--debug="))) {
} else if (QByteArray(argv[i]).startsWith("--debug=")) {
argc = i + 1;
debugFound = true;
}
......@@ -381,7 +387,7 @@ int main( int argc, char *argv[] )
KDevelopApplication app(argc, argv);
KLocalizedString::setApplicationDomain("kdevelop");
KAboutData aboutData( QStringLiteral("kdevelop"), i18n( "KDevelop" ), QByteArray(KDEVELOP_VERSION_STRING),
KAboutData aboutData( QStringLiteral("kdevelop"), i18n("KDevelop"), QStringLiteral(KDEVELOP_VERSION_STRING),
i18n("The KDevelop Integrated Development Environment"),
KAboutLicense::GPL,
i18n("Copyright 1999-2018, The KDevelop developers"), QString(), QStringLiteral("https://www.kdevelop.org/"));
......@@ -467,17 +473,30 @@ int main( int argc, char *argv[] )
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption{QStringList{"n", "new-session"}, i18n("Open KDevelop with a new session using the given name."), QStringLiteral("name")});
parser.addOption(QCommandLineOption{QStringList{"s", "open-session"}, i18n("Open KDevelop with the given session.\n"
"You can pass either hash or the name of the session." ), QStringLiteral("session")});
parser.addOption(QCommandLineOption{QStringList{"rm", "remove-session"}, i18n("Delete the given session.\n"
"You can pass either hash or the name of the session." ), QStringLiteral("session")});
parser.addOption(QCommandLineOption{QStringList{"ps", "pick-session"}, i18n("Shows all available sessions and lets you select one to open.")});
parser.addOption(QCommandLineOption{QStringList{"pss", "pick-session-shell"}, i18n("List all available sessions on shell and lets you select one to open.")});
parser.addOption(QCommandLineOption{QStringList{"l", "list-sessions"}, i18n("List available sessions and quit.")});
parser.addOption(QCommandLineOption{QStringList{"f", "fetch"}, i18n("Open KDevelop and fetch the project from the given <repo url>."), QStringLiteral("repo url")});
parser.addOption(QCommandLineOption{QStringList{"p", "project"}, i18n("Open KDevelop and load the given project. <project> can be either a .kdev4 file or a directory path."), QStringLiteral("project")});
parser.addOption(QCommandLineOption{QStringList{"d", "debug"},
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("n"), QStringLiteral("new-session")},
i18n("Open KDevelop with a new session using the given name."),
QStringLiteral("name")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("s"), QStringLiteral("open-session")},
i18n("Open KDevelop with the given session.\n"
"You can pass either hash or the name of the session."),
QStringLiteral("session")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("rm"), QStringLiteral("remove-session")},
i18n("Delete the given session.\n"
"You can pass either hash or the name of the session." ),
QStringLiteral("session")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("ps"), QStringLiteral("pick-session")},
i18n("Shows all available sessions and lets you select one to open.")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("pss"), QStringLiteral("pick-session-shell")},
i18n("List all available sessions on shell and lets you select one to open.")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("l"), QStringLiteral("list-sessions")},
i18n("List available sessions and quit.")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("f"), QStringLiteral("fetch")},
i18n("Open KDevelop and fetch the project from the given <repo url>."),
QStringLiteral("repo url")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("p"), QStringLiteral("project")},
i18n("Open KDevelop and load the given project. <project> can be either a .kdev4 file or a directory path."),
QStringLiteral("project")});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("d"), QStringLiteral("debug")},
i18n("Start debugging an application in KDevelop with the given debugger.\n"
"The executable that should be debugged must follow - including arguments.\n"
"Example: kdevelop --debug gdb myapp --foo bar"), QStringLiteral("debugger")});
......@@ -489,7 +508,7 @@ int main( int argc, char *argv[] )
// session is running, then we should just return the PID of that session.
// Otherwise, we should print a command-line session-chooser dialog ("--pss"),
// which only shows the running sessions, and the user can pick one.
parser.addOption(QCommandLineOption{QStringList{"pid"}});
parser.addOption(QCommandLineOption{QStringList{QStringLiteral("pid")}});
parser.addPositionalArgument(QStringLiteral("files"),
i18n( "Files to load, or directories to load as projects" ), QStringLiteral("[FILE[:line[:column]] | DIRECTORY]..."));
......
......@@ -110,7 +110,7 @@ public:
clearFilter();
return;
}
if ( typedFragments.last().endsWith(':') ) {
if ( typedFragments.last().endsWith(QLatin1Char(':')) ) {
// remove the trailing colon if there's only one; otherwise,
// this breaks incremental filtering
typedFragments.last().chop(1);
......
......@@ -6,9 +6,9 @@
<kcfgfile />
<group name="Android">
<entry name="cmakeToolchain" type="Path"><default code="true">QStandardPaths::locate(QStandardPaths::GenericDataLocation, "ECM/toolchain/Android.cmake")</default></entry>
<entry name="ndk" type="Path"><default code="true">qgetenv("ANDROID_NDK")</default></entry>
<entry name="sdk" type="Path"><default code="true">qgetenv("ANDROID_HOME")</default></entry>
<entry name="cmakeToolchain" type="Path"><default code="true">QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("ECM/toolchain/Android.cmake"))</default></entry>
<entry name="ndk" type="Path"><default code="true">QString::fromUtf8(qgetenv("ANDROID_NDK"))</default></entry>
<entry name="sdk" type="Path"><default code="true">QString::fromUtf8(qgetenv("ANDROID_HOME"))</default></entry>
<entry name="arch" type="String"><default>arm</default></entry>
<entry name="toolchain" type="String"><default>arm-linux-androideabi</default></entry>
<entry name="abi" type="String"><default>armeabi-v7a</default></entry>
......
......@@ -43,8 +43,8 @@ void AndroidRuntime::setEnabled(bool /*enable*/)
static void setEnvironmentVariables(QProcess* process)
{
auto env = process->processEnvironment();
env.insert("ANDROID_NDK", AndroidRuntime::s_settings->ndk());
env.insert("ANDROID_SDK_ROOT", AndroidRuntime::s_settings->sdk());
env.insert(QStringLiteral("ANDROID_NDK"), AndroidRuntime::s_settings->ndk());
env.insert(QStringLiteral("ANDROID_SDK_ROOT"), AndroidRuntime::s_settings->sdk());
process->setProcessEnvironment(env);
}
......@@ -52,14 +52,14 @@ static void setEnvironmentVariables(QProcess* process)
static QStringList args()
{
return {
"-DCMAKE_TOOLCHAIN_FILE=" + AndroidRuntime::s_settings->cmakeToolchain(),
"-DANDROID_ABI=" + AndroidRuntime::s_settings->abi(),
"-DANDROID_NDK=" + AndroidRuntime::s_settings->ndk(),
"-DANDROID_TOOLCHAIN=" + AndroidRuntime::s_settings->toolchain(),
"-DANDROID_API_LEVEL=" + AndroidRuntime::s_settings->api(),
"-DANDROID_ARCHITECTURE=" + AndroidRuntime::s_settings->arch(),
"-DANDROID_SDK_BUILD_TOOLS_REVISION=" + AndroidRuntime::s_settings->buildtools()
QLatin1String("-DCMAKE_TOOLCHAIN_FILE=") + AndroidRuntime::s_settings->cmakeToolchain(),
QLatin1String("-DANDROID_ABI=") + AndroidRuntime::s_settings->abi(),
QLatin1String("-DANDROID_NDK=") + AndroidRuntime::s_settings->ndk(),
QLatin1String("-DANDROID_TOOLCHAIN=") + AndroidRuntime::s_settings->toolchain(),
QLatin1String("-DANDROID_API_LEVEL=") + AndroidRuntime::s_settings->api(),
QLatin1String("-DANDROID_ARCHITECTURE=") + AndroidRuntime::s_settings->arch(),
QLatin1String("-DANDROID_SDK_BUILD_TOOLS_REVISION=") + AndroidRuntime::s_settings->buildtools()
};
}
......@@ -81,11 +81,11 @@ void AndroidRuntime::startProcess(KProcess* process) const
setEnvironmentVariables(process);
}
qCDebug(ANDROID) << "starting kprocess" << process->program().join(' ');
qCDebug(ANDROID) << "starting kprocess" << process->program().join(QLatin1Char(' '));
process->start();
}
QByteArray AndroidRuntime::getenv(const QByteArray &varname) const
{
return qgetenv(varname);
return qgetenv(varname.constData());
}
......@@ -199,7 +199,7 @@ bool initializeCVCS(ICentralizedVersionControl* cvcs, const ApplicationInfo& inf
QString generateIdentifier( const QString& appname )
{
QString tmp = appname;
QRegExp re("[^a-zA-Z0-9_]");
QRegExp re(QStringLiteral("[^a-zA-Z0-9_]"));
return tmp.replace(re, QStringLiteral("_"));
}
......@@ -358,7 +358,7 @@ QString AppWizardPlugin::createProject(const ApplicationInfo& info)
return QString();
}
QString projectFileName = QDir::cleanPath( dest.toLocalFile() + '/' + info.name + ".kdev4" );
QString projectFileName = QDir::cleanPath(dest.toLocalFile() + QLatin1Char('/') + info.name + QLatin1String(".kdev4"));
// Loop through the new project directory and try to detect the first .kdev4 file.
// If one is found this file will be used. So .kdev4 file can be stored in any subdirectory and the
......@@ -435,7 +435,7 @@ bool AppWizardPlugin::unpackArchive(const KArchiveDirectory* dir, const QString&
const auto entry = dir->entry(entryName);
if (entry->isDirectory()) {
const KArchiveDirectory* subdir = static_cast<const KArchiveDirectory*>(entry);
QString newdest = dest + '/' + KMacroExpander::expandMacros(subdir->name(), m_variables);
const QString newdest = dest + QLatin1Char('/') + KMacroExpander::expandMacros(subdir->name(), m_variables);
if( !QFileInfo::exists( newdest ) )
{
QDir::root().mkdir( newdest );
......@@ -445,8 +445,8 @@ bool AppWizardPlugin::unpackArchive(const KArchiveDirectory* dir, const QString&
else if (entry->isFile()) {
const KArchiveFile* file = static_cast<const KArchiveFile*>(entry);
file->copyTo(tdir.path());
QString destName = dest + '/' + file->name();
if (!copyFileAndExpandMacros(QDir::cleanPath(tdir.path()+'/'+file->name()),
const QString destName = dest + QLatin1Char('/') + file->name();
if (!copyFileAndExpandMacros(QDir::cleanPath(tdir.path() + QLatin1Char('/') + file->name()),
KMacroExpander::expandMacros(destName, m_variables)))
{
KMessageBox::sorry(nullptr, i18n("The file %1 cannot be created.", dest));
......
......@@ -148,7 +148,7 @@ QString ProjectSelectionPage::selectedTemplate()
QUrl ProjectSelectionPage::location()
{
QUrl url = ui->locationUrl->url().adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + encodedProjectName());
url.setPath(url.path() + QLatin1Char('/') + QString::fromUtf8(encodedProjectName()));
return url;
}
......@@ -236,7 +236,7 @@ void ProjectSelectionPage::validateData()
}
// Check for non-empty target directory. Not an error, but need to display a warning.
url.setPath( url.path() + '/' + encodedProjectName() );
url.setPath(url.path() + QLatin1Char('/') + QString::fromUtf8(encodedProjectName()));
QFileInfo fi( url.toLocalFile() );
if( fi.exists() && fi.isDir() )
{
......@@ -256,9 +256,10 @@ QByteArray ProjectSelectionPage::encodedProjectName()
QByteArray tEncodedName = projectName().toUtf8();
for (int i = 0; i < tEncodedName.size(); ++i)
{
QChar tChar(tEncodedName.at( i ));
if (tChar.isDigit() || tChar.isSpace() || tChar.isLetter() || tChar == '%')
QChar tChar(QLatin1Char(tEncodedName.at(i)));
if (tChar.isDigit() || tChar.isSpace() || tChar.isLetter() || tChar == QLatin1Char('%')) {
continue;
}
QByteArray tReplace = QUrl::toPercentEncoding( tChar );
tEncodedName.replace( tEncodedName.at( i ) ,tReplace );
......
......@@ -71,7 +71,7 @@ void AStyleFormatter::updateFormatter()
m_indentString = QStringLiteral("\t");
} else {
AStyleFormatter::setSpaceIndentation(wsCount);
m_indentString.fill(' ', wsCount);
m_indentString.fill(QLatin1Char(' '), wsCount);
AStyleFormatter::setTabSpaceConversionMode(m_options[QStringLiteral("FillForce")].toBool());
}
......@@ -315,7 +315,7 @@ QVariant AStyleFormatter::option(const QString &key)
QString AStyleFormatter::indentString()
{
return QString(getIndentString().c_str());
return QString::fromUtf8(getIndentString().c_str());
}
void AStyleFormatter::loadStyle(const QString &content)
......@@ -332,7 +332,7 @@ QString AStyleFormatter::saveStyle()
void AStyleFormatter::setTabIndentation(int length, bool forceTabs)
{
ASFormatter::setTabIndentation(length, forceTabs);
m_options[QStringLiteral("Fill")] = "Tabs";
m_options[QStringLiteral("Fill")] = QStringLiteral("Tabs");
m_options[QStringLiteral("FillForce")] = forceTabs;
m_options[QStringLiteral("FillCount")] = length;
}
......@@ -340,7 +340,7 @@ void AStyleFormatter::setTabIndentation(int length, bool forceTabs)
void AStyleFormatter::setSpaceIndentation(int length)
{
ASFormatter::setSpaceIndentation(length);
m_options[QStringLiteral("Fill")] = "Spaces";
m_options[QStringLiteral("Fill")] = QStringLiteral("Spaces");
m_options[QStringLiteral("FillCount")] = length;
}
......@@ -421,19 +421,19 @@ void AStyleFormatter::setBracketFormatMode(astyle::BracketMode mode)
{
switch (mode) {
case astyle::NONE_MODE:
m_options[QStringLiteral("Brackets")] = "";
m_options[QStringLiteral("Brackets")] = QString();
break;
case astyle::ATTACH_MODE:
m_options[QStringLiteral("Brackets")] = "Attach";
m_options[QStringLiteral("Brackets")] = QStringLiteral("Attach");
break;
case astyle::BREAK_MODE:
m_options[QStringLiteral("Brackets")] = "Break";
m_options[QStringLiteral("Brackets")] = QStringLiteral("Break");
break;
case astyle::LINUX_MODE:
m_options[QStringLiteral("Brackets")] = "Linux";
m_options[QStringLiteral("Brackets")] = QStringLiteral("Linux");
break;
case astyle::RUN_IN_MODE:
m_options[QStringLiteral("Brackets")] = "RunInMode";
m_options[QStringLiteral("Brackets")] = QStringLiteral("RunInMode");
break;
}
ASFormatter::setBracketFormatMode(mode);
......@@ -508,16 +508,16 @@ void AStyleFormatter::setPointerAlignment(astyle::PointerAlign alignment)
{
switch (alignment) {
case astyle::PTR_ALIGN_NONE:
m_options[QStringLiteral("PointerAlign")] = "None";
m_options[QStringLiteral("PointerAlign")] = QStringLiteral("None");
break;
case astyle::PTR_ALIGN_NAME:
m_options[QStringLiteral("PointerAlign")] = "Name";
m_options[QStringLiteral("PointerAlign")] = QStringLiteral("Name");
break;
case astyle::PTR_ALIGN_MIDDLE:
m_options[QStringLiteral("PointerAlign")] = "Middle";
m_options[QStringLiteral("PointerAlign")] = QStringLiteral("Middle");
break;
case astyle::PTR_ALIGN_TYPE:
m_options[QStringLiteral("PointerAlign")] = "Type";
m_options[QStringLiteral("PointerAlign")] = QStringLiteral("Type");
break;
}
ASFormatter::setPointerAlignment(alignment);
......
......@@ -146,7 +146,7 @@ SettingsWidget* AStylePlugin::editStyleWidget(const QMimeType& mime) const
QString AStylePlugin::previewText(const SourceFormatterStyle& /*style*/, const QMimeType& /*mime*/) const
{
return "// Indentation\n" + indentingSample() + "\t// Formatting\n"
return QLatin1String("// Indentation\n") + indentingSample() + QLatin1String("\t// Formatting\n")
+ formattingSample();
}
......@@ -174,7 +174,7 @@ AStylePlugin::Indentation AStylePlugin::indentation(const QUrl& url) const
QString AStylePlugin::formattingSample()
{
return
return QLatin1String(
"void func(){\n"
"\tif(isFoo(a,b))\n"
"\tbar(a,b);\n"
......@@ -207,7 +207,8 @@ QString AStylePlugin::formattingSample()
"}\n"
"};\n"
"}\n"
"}\n";
"}\n"
);
}
QString AStylePlugin::indentingSample()
......
......@@ -146,7 +146,7 @@ bool BazaarPlugin::isVersionControlled(const QUrl& localLocation)
job->exec();
if (job->status() == VcsJob::JobSucceeded) {
QList<QFileInfo> filesAndDirectoriesList;
const auto output = job->output().split('\n');
const auto output = job->output().split(QLatin1Char('\n'));
filesAndDirectoriesList.reserve(output.size());
for (const auto& fod : output) {
filesAndDirectoriesList.append(QFileInfo(workCopy.absolutePath() + QDir::separator() + fod));
......@@ -281,7 +281,7 @@ void BazaarPlugin::parseBzrStatus(DVcsJob* job)
QVariantList result;
QSet<QString> filesWithStatus;
QDir workingCopy = job->directory();
const auto output = job->output().split('\n');
const auto output = job->output().split(QLatin1Char('\n'));
result.reserve(output.size());
for (const auto& line : output) {
auto status = BazaarUtils::parseVcsStatusInfoLine(line);
......
......@@ -96,7 +96,7 @@ QString BazaarUtils::getRevisionSpecRange(const KDevelop::VcsRevision& begin,
} else if (end.revisionType() == KDevelop::VcsRevision::GlobalNumber)
return QStringLiteral("-r") +
QString::number(end.revisionValue().toLongLong() - 1)
+ ".." + QString::number(end.revisionValue().toLongLong());
+ QLatin1String("..") + QString::number(end.revisionValue().toLongLong());
else
return QString(); // Don't know how to handle this situation
} else if (begin.specialType() == KDevelop::VcsRevision::Base ||
......@@ -110,7 +110,7 @@ QString BazaarUtils::getRevisionSpecRange(const KDevelop::VcsRevision& begin,
return QStringLiteral("-r") + QString::number(begin.revisionValue().toLongLong());
} else {
return QStringLiteral("-r") + QString::number(begin.revisionValue().toLongLong())
+ ".." + QString::number(end.revisionValue().toLongLong());
+ QLatin1String("..") + QString::number(end.revisionValue().toLongLong());
}
}
return QString(); // Don't know how to handle this situation
......@@ -125,7 +125,7 @@ bool BazaarUtils::isValidDirectory(const QUrl& dirPath)
KDevelop::VcsStatusInfo BazaarUtils::parseVcsStatusInfoLine(const QString& line)
{
QStringList tokens = line.split(' ', QString::SkipEmptyParts);
QStringList tokens = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
KDevelop::VcsStatusInfo result;
if (tokens.size() < 2) // Don't know how to handle this situation (it is an error)
return result;
......@@ -155,7 +155,7 @@ QString BazaarUtils::concatenatePath(const QDir& workingCopy, const QUrl& pathIn
KDevelop::VcsEvent BazaarUtils::parseBzrLogPart(const QString& output)
{
const QStringList outputLines = output.split('\n');
const QStringList outputLines = output.split(QLatin1Char('\n'));
KDevelop::VcsEvent commitInfo;
bool atMessage = false;
QString message;
......@@ -166,7 +166,7 @@ KDevelop::VcsEvent BazaarUtils::parseBzrLogPart(const QString& output)
if (!atMessage) {
if (line.startsWith(QStringLiteral("revno"))) {
QString revno = line.mid(QStringLiteral("revno: ").length());
revno = revno.left(revno.indexOf(' '));
revno = revno.left(revno.indexOf(QLatin1Char(' ')));
KDevelop::VcsRevision revision;
revision.setRevisionValue(revno.toLongLong(), KDevelop::VcsRevision::GlobalNumber);
commitInfo.setRevision(revision);
......
......@@ -63,7 +63,7 @@ void BzrAnnotateJob::start()
void BzrAnnotateJob::parseBzrAnnotateOutput(KDevelop::DVcsJob* job)
{
m_outputLines = job->output().split('\n');
m_outputLines = job->output().split(QLatin1Char('\n'));
m_currentLine = 0;
if (m_status == KDevelop::VcsJob::JobRunning)
QTimer::singleShot(0, this, &BzrAnnotateJob::parseNextLine);
......@@ -86,7 +86,7 @@ void BzrAnnotateJob::parseNextLine()
continue;
}
bool revOk;
auto revision = currentLine.leftRef(currentLine.indexOf(' ')).toULong(&revOk);
auto revision = currentLine.leftRef(currentLine.indexOf(QLatin1Char(' '))).toULong(&revOk);
if (!revOk) {
// Future compatibility - not a revision yet
++m_currentLine;
......@@ -132,7 +132,7 @@ void BzrAnnotateJob::prepareCommitInfo(std::size_t revision)
*/
void BzrAnnotateJob::parseBzrLog(KDevelop::DVcsJob* job)
{
const QStringList outputLines = job->output().split('\n');
const QStringList outputLines = job->output().split(QLatin1Char('\n'));
KDevelop::VcsEvent commitInfo;
int revision=-1;
bool atMessage = false;
......@@ -148,7 +148,7 @@ void BzrAnnotateJob::parseBzrLog(KDevelop::DVcsJob* job)
// The same below with exception of "commiter" which possibly
// can have also some suffix which changes meaning like
// "commiter-some_property: "...
revno = revno.left(revno.indexOf(' '));
revno = revno.left(revno.indexOf(QLatin1Char(' ')));
revision = revno.toInt();
KDevelop::VcsRevision revision;
revision.setRevisionValue(revno.toLongLong(), KDevelop::VcsRevision::GlobalNumber);
......
......@@ -120,7 +120,7 @@ void ChecksWidget::setChecks(const QString& checks)
setState(m_ui->checksTree->topLevelItem(i), Qt::Unchecked);
}
const QStringList checksList = checks.split(',', QString::SkipEmptyParts);
const QStringList checksList = checks.split(QLatin1Char(','), QString::SkipEmptyParts);
for (auto checkName : checksList) {
checkName = checkName.trimmed();
if (checkName == QStringLiteral("manual")) {
......
......@@ -58,7 +58,7 @@ void CommandLineWidget::updateCommandLine()
auto filterText = m_ui->cmdFilter->lineEdit()->text();
if (!filterText.isEmpty()) {
QStringList lines = commandLine.split('\n');
QStringList lines = commandLine.split(QLatin1Char('\n'));
QMutableStringListIterator i(lines);
while (i.hasNext()) {
......
......@@ -134,8 +134,8 @@ QString Job::buildMakefile(const JobParameters& params)
void Job::postProcessStdout(const QStringList& lines)
{
static const auto startedRegex = QRegularExpression("Clazy check started for (.+)$");
static const auto finishedRegex = QRegularExpression("Clazy check finished for (.+)$");
static const auto startedRegex = QRegularExpression(QStringLiteral("Clazy check started for (.+)$"));
static const auto finishedRegex = QRegularExpression(QStringLiteral("Clazy check finished for (.+)$"));
for (const QString & line : lines) {
auto match = startedRegex.match(line);
......
......@@ -51,13 +51,13 @@ namespace Clazy
{
Plugin::Plugin(QObject* parent, const QVariantList&)
: IPlugin("kdevclazy", parent)
: IPlugin(QStringLiteral("kdevclazy"), parent)
, m_job(nullptr)
, m_project(nullptr)
, m_model(new ProblemModel(this))
, m_db(nullptr)
{
setXMLFile("kdevclazy.rc");
setXMLFile(QStringLiteral("kdevclazy.rc"));
const QIcon clazyIcon = QIcon::fromTheme(QStringLiteral("clazy"));
......@@ -66,14 +66,14 @@ Plugin::Plugin(QObject* parent, const QVariantList&)
m_menuActionFile = new QAction(clazyIcon, i18n("Analyze Current File with Clazy"), this);
connect(m_menuActionFile, &QAction::triggered, this, runFileAnalysis);
actionCollection()->addAction("clazy_file", m_menuActionFile);
actionCollection()->addAction(QStringLiteral("clazy_file"), m_menuActionFile);
m_contextActionFile = new QAction(clazyIcon, i18n("Clazy"), this);
connect(m_contextActionFile, &QAction::triggered, this, runFileAnalysis);
m_menuActionProject = new QAction(clazyIcon, i18n("Analyze Current Project with Clazy"), this);
connect(m_menuActionProject, &QAction::triggered, this, runProjectAnalysis);
actionCollection()->addAction("clazy_project", m_menuActionProject);
actionCollection()->addAction(QStringLiteral("clazy_project"), m_menuActionProject);
m_contextActionProject = new QAction(clazyIcon, i18n("Clazy"), this);
connect(m_contextActionProject, &QAction::triggered, this, runProjectAnalysis);
......@@ -191,7 +191,7 @@ void Plugin::runClazy(KDevelop::IProject* project, const QString& path)
connect(m_job, &Job::problemsDetected, m_model, &ProblemModel::addProblems);
connect(m_job, &Job::finished, this, &Plugin::result);
core()->uiController()->registerStatus(new KDevelop::JobStatus(m_job, "clazy"));
core()->uiController()->registerStatus(new KDevelop::JobStatus(m_job, QStringLiteral("clazy")));
core()->runController()->registerJob(m_job);
if (GlobalSettings::hideOutputView()) {
......
......@@ -125,14 +125,14 @@ public:
html.clear();
html += QStringLiteral("<html>");
auto lines = markdown.split('\n');
auto lines = markdown.split(QLatin1Char('\n'));
for (auto line : lines) {
if (line.isEmpty()) {
setState(EMPTY);
continue;
}
if (line.startsWith("#")) {
if (line.startsWith(QLatin1Char('#'))) {
auto match = hRE.match(line);
if (match.hasMatch()) {
setState(HEADING);
......@@ -244,7 +244,7 @@ private:
QString markdown2html(const QByteArray& markdown)
{
MarkdownConverter converter;
return converter.toHtml(markdown);
return converter.toHtml(QString::fromUtf8(markdown));
}
}
......@@ -56,7 +56,7 @@ bool isFunction(const Declaration* decl)
bool isPathChar(const QChar& c)
{
return c.isLetterOrNumber() || c=='/' || c=='.';
return c.isLetterOrNumber() || c == QLatin1Char('/') || c == QLatin1Char('.');
}
QString escapePath(QString path)
......@@ -88,14 +88,14 @@ void CMakeCodeCompletionModel::completionInvoked(View* view, const Range& range,
QString line=d->line(range.end().line());
// m_inside=line.lastIndexOf('(', range.end().column())>=0;
m_inside=line.lastIndexOf('(', range.end().column()-line.size()-1)>=0;
m_inside=line.lastIndexOf(QLatin1Char('('), range.end().column()-line.size()-1)>=0;
for(int l=range.end().line(); l>=0 && !m_inside; --l)
{
QString cline=d->line(l);
QString line=cline.left(cline.indexOf('#'));
QString line=cline.left(cline.indexOf(QLatin1Char('#')));
int close=line.lastIndexOf(')'), open=line.indexOf('(');
int close=line.lastIndexOf(QLatin1Char(')')), open=line.indexOf(QLatin1Char('('));
if(close>=0 && open>=0) {
m_inside=open>close;
......@@ -118,8 +118,8 @@ void CMakeCodeCompletionModel::completionInvoked(View* view, const Range& range,
QString tocomplete=d->text(Range(start, range.end()-Cursor(0,1)));
int lastdir=tocomplete.lastIndexOf('/');
QString path = KIO::upUrl(QUrl(d->url())).adjusted(QUrl::StripTrailingSlash).toLocalFile()+'/';
int lastdir=tocomplete.lastIndexOf(QLatin1Char('/'));
QString path = KIO::upUrl(QUrl(d->url())).adjusted(QUrl::StripTrailingSlash).toLocalFile()+QLatin1Char('/');
QString basePath;
if(lastdir>=0) {
basePath=tocomplete.mid(0, lastdir);
......@@ -127,14 +127,14 @@ void CMakeCodeCompletionModel::completionInvoked(View* view, const Range& range,
}
QDir dir(path);
const QFileInfoList paths = dir.entryInfoList(QStringList() << tocomplete.mid(lastdir+1)+'*',
const QFileInfoList paths = dir.entryInfoList(QStringList(tocomplete.midRef(lastdir+1)+QLatin1Char('*')),
QDir::AllEntries | QDir::NoDotAndDotDot);
m_paths.clear();
m_paths.reserve(paths.size());
for (const QFileInfo& f : paths) {
QString currentPath = f.fileName();
if(f.isDir())
currentPath+='/';
currentPath += QLatin1Char('/');
m_paths += currentPath;
}
......@@ -267,7 +267,7 @@ QVariant CMakeCodeCompletionModel::data (const QModelIndex & index, int role) co
DelayedType::Ptr delay = t.cast<DelayedType>();
args.append(delay ? delay->identifier().toString() : i18n("wrong"));