diff --git a/src/Application.cpp b/src/Application.cpp index 2572164a..fd44ce35 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -141,7 +141,7 @@ void Application::populateCommandLineParser(QCommandLineParser *parser) QStringList Application::getCustomCommand(QStringList &args) { - int i = args.indexOf(QStringLiteral("-e")); + int i = args.indexOf(QLatin1String("-e")); QStringList customCommand; if ((0 < i) && (i < (args.size() - 1))) { // -e was specified with at least one extra argument @@ -310,8 +310,8 @@ bool Application::processTabsFromFileArgs(MainWindow *window) lineTokens[key] = value; } // should contain at least one of 'command' and 'profile' - if (lineTokens.contains(QStringLiteral("command")) - || lineTokens.contains(QStringLiteral("profile"))) { + if (lineTokens.contains(QLatin1String("command")) + || lineTokens.contains(QLatin1String("profile"))) { createTabFromArgs(window, lineTokens); sessions++; } else { diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp index d20f6c8d..cf1d8f0e 100644 --- a/src/ColorSchemeEditor.cpp +++ b/src/ColorSchemeEditor.cpp @@ -203,7 +203,7 @@ void ColorSchemeEditor::selectWallpaper() for (const QByteArray &mime : mimeTypes) { fileFormats += QStringLiteral("*.%1 ").arg(QLatin1String(mime)); } - fileFormats += QLatin1String(")"); + fileFormats += QLatin1Char(')'); const QString fileName = QFileDialog::getOpenFileName(this, i18nc("@title:window", diff --git a/src/ColorSchemeManager.cpp b/src/ColorSchemeManager.cpp index 0a9a3cd3..0b030234 100644 --- a/src/ColorSchemeManager.cpp +++ b/src/ColorSchemeManager.cpp @@ -221,7 +221,7 @@ const ColorScheme *ColorSchemeManager::findColorScheme(const QString &name) QString ColorSchemeManager::findColorSchemePath(const QString &name) const { - QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".colorscheme")); + QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("konsole/") + name + QLatin1String(".colorscheme")); if (!path.isEmpty()) { return path; @@ -247,7 +247,7 @@ bool ColorSchemeManager::isColorSchemeDeletable(const QString &name) bool ColorSchemeManager::canResetColorScheme(const QString &name) { - const QStringList paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".colorscheme")); + const QStringList paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("konsole/") + name + QLatin1String(".colorscheme")); // if the colorscheme exists in both a writable location under the // user's home dir and a system-wide location, then it's possible diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index 03c56e52..06674bd2 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -507,7 +507,7 @@ void EditProfileDialog::showEnvironmentEditor() QString text = QInputDialog::getMultiLineText(this, i18n("Edit Environment"), i18n("One environment variable per line"), - currentEnvironment.join(QStringLiteral("\n")), + currentEnvironment.join(QLatin1Char('\n')), &ok); QStringList newEnvironment; diff --git a/src/KeyboardTranslatorManager.cpp b/src/KeyboardTranslatorManager.cpp index 883e715c..ac70f44e 100644 --- a/src/KeyboardTranslatorManager.cpp +++ b/src/KeyboardTranslatorManager.cpp @@ -85,7 +85,7 @@ bool KeyboardTranslatorManager::isTranslatorDeletable(const QString &name) const bool KeyboardTranslatorManager::isTranslatorResettable(const QString &name) const { - const QStringList &paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")); + const QStringList &paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("konsole/") + name + QLatin1String(".keytab")); return (paths.count() > 1); } diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp index ed68f737..2e9633a5 100644 --- a/src/ProcessInfo.cpp +++ b/src/ProcessInfo.cpp @@ -141,7 +141,7 @@ QSet ProcessInfo::commonDirNames() QString ProcessInfo::formatShortDir(const QString &input) const { - if(input == QStringLiteral("/")) { + if(input == QLatin1String("/")) { return QStringLiteral("/"); } @@ -1151,7 +1151,7 @@ QString SSHProcessInfo::format(const QString &input) const // Depending on whether -l was passed to ssh (which is mostly not the // case due to ~/.ssh/config). if (_user.isEmpty()) { - output.replace(QLatin1String("%U"), QString()); + output.remove(QLatin1String("%U")); } else { output.replace(QLatin1String("%U"), _user + QLatin1Char('@')); } diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 0387a79b..fa6f3822 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -100,7 +100,7 @@ ProfileManager::ProfileManager() _defaultProfile = _fallbackProfile; if (!defaultProfileFileName.isEmpty()) { // load the default profile - const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + defaultProfileFileName); + const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("konsole/") + defaultProfileFileName); if (!path.isEmpty()) { Profile::Ptr profile = loadProfile(path); @@ -146,7 +146,7 @@ Profile::Ptr ProfileManager::loadProfile(const QString& shortPath) if (fileInfo.suffix() != QLatin1String("profile")) { path.append(QLatin1String(".profile")); } - if (fileInfo.path().isEmpty() || fileInfo.path() == QLatin1String(".")) { + if (fileInfo.path().isEmpty() || fileInfo.path() == QLatin1Char('.')) { path.prepend(QLatin1String("konsole") + QDir::separator()); } @@ -379,7 +379,7 @@ void ProfileManager::changeProfile(Profile::Ptr profile, QString newName; QString newTranslatedName; do { - newName = QStringLiteral("Profile ") + QString::number(nameSuffix); + newName = QLatin1String("Profile ") + QString::number(nameSuffix); newTranslatedName = i18nc("The default name of a profile", "Profile #%1", nameSuffix); // TODO: remove the # above and below - too many issues newTranslatedName.remove(QLatin1Char('#')); @@ -562,7 +562,7 @@ void ProfileManager::loadShortcuts() // if the file is not an absolute path, look it up QFileInfo fileInfo(profilePath); if (!fileInfo.isAbsolute()) { - profilePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + profilePath); + profilePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("konsole/") + profilePath); } data.profilePath = profilePath; diff --git a/src/Session.cpp b/src/Session.cpp index 83364ceb..3cd0f4bb 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -493,7 +493,7 @@ void Session::run() int result = _shellProcess->start(exec, arguments, _environment); if (result < 0) { - terminalWarning(i18n("Could not start program '%1' with arguments '%2'.", exec, arguments.join(QLatin1String(" ")))); + terminalWarning(i18n("Could not start program '%1' with arguments '%2'.", exec, arguments.join(QLatin1Char(' ')))); terminalWarning(_shellProcess->errorString()); return; } diff --git a/src/SessionController.cpp b/src/SessionController.cpp index c801455c..37e14d4c 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -1546,7 +1546,7 @@ void SessionController::updateSessionIcon() { // If the default profile icon is being used, don't put it on the tab // Only show the icon if the user specifically chose one - if (_session->iconName() == QStringLiteral("utilities-terminal")) { + if (_session->iconName() == QLatin1String("utilities-terminal")) { _sessionIconName = QString(); } else { _sessionIconName = _session->iconName(); diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index 32945a9f..81157301 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -98,7 +98,7 @@ TabbedViewContainer::TabbedViewContainer(ViewManager *connectedViewManager, QWid connect(_contextPopupMenu, &QMenu::aboutToHide, this, [this]() { // Remove the read-only action when the popup closes for (auto &action : _contextPopupMenu->actions()) { - if (action->objectName() == QStringLiteral("view-readonly")) { + if (action->objectName() == QLatin1String("view-readonly")) { _contextPopupMenu->removeAction(action); break; } @@ -470,7 +470,7 @@ void TabbedViewContainer::openTabContextMenu(const QPoint &point) //TODO: add a countChanged signal so we can remove this for. // Detaching in mac causes crashes. for(auto action : _contextPopupMenu->actions()) { - if (action->objectName() == QStringLiteral("tab-detach")) { + if (action->objectName() == QLatin1String("tab-detach")) { action->setEnabled(count() > 1); } } @@ -493,7 +493,7 @@ void TabbedViewContainer::openTabContextMenu(const QPoint &point) // Disable tab rename for (auto &action : _contextPopupMenu->actions()) { - if (action->objectName() == QStringLiteral("edit-rename")) { + if (action->objectName() == QLatin1String("edit-rename")) { action->setEnabled(!sessionController->isReadOnly()); break; } diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index ebceaeed..4e7367b1 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -903,7 +903,7 @@ namespace { ViewSplitter *restoreSessionsSplitterRecurse(const QJsonObject& jsonSplitter, ViewManager *manager) { auto splitterWidgets = jsonSplitter[QStringLiteral("Widgets")].toArray(); - auto orientation = (jsonSplitter[QStringLiteral("Orientation")].toString() == QStringLiteral("Horizontal")) + auto orientation = (jsonSplitter[QStringLiteral("Orientation")].toString() == QLatin1String("Horizontal")) ? Qt::Horizontal : Qt::Vertical; auto *currentSplitter = new ViewSplitter(); diff --git a/src/autotests/PartTest.cpp b/src/autotests/PartTest.cpp index e113edf2..476f93b0 100644 --- a/src/autotests/PartTest.cpp +++ b/src/autotests/PartTest.cpp @@ -51,7 +51,7 @@ void PartTest::initTestCase() auto buildPath = libraryPaths.last(); QCoreApplication::removeLibraryPath(buildPath); // konsolepart.so is in ../autotests/ - if (buildPath.endsWith(QStringLiteral("/autotests"))) { + if (buildPath.endsWith(QLatin1String("/autotests"))) { buildPath.chop(10); } QCoreApplication::addLibraryPath(buildPath); diff --git a/src/autotests/ShellCommandTest.cpp b/src/autotests/ShellCommandTest.cpp index 3f3c3a03..d66e9dcf 100644 --- a/src/autotests/ShellCommandTest.cpp +++ b/src/autotests/ShellCommandTest.cpp @@ -54,7 +54,7 @@ void ShellCommandTest::testConstructorWithTwoArguments() ShellCommand shellCommand(command, arguments); QCOMPARE(shellCommand.command(), command); QCOMPARE(shellCommand.arguments(), arguments); - QCOMPARE(shellCommand.fullCommand(), arguments.join(QLatin1String(" "))); + QCOMPARE(shellCommand.fullCommand(), arguments.join(QLatin1Char(' '))); } void ShellCommandTest::testExpandEnvironmentVariable() diff --git a/src/autotests/TerminalInterfaceTest.cpp b/src/autotests/TerminalInterfaceTest.cpp index 8dc61689..10d4d9b2 100644 --- a/src/autotests/TerminalInterfaceTest.cpp +++ b/src/autotests/TerminalInterfaceTest.cpp @@ -57,7 +57,7 @@ void TerminalInterfaceTest::initTestCase() auto buildPath = libraryPaths.last(); QCoreApplication::removeLibraryPath(buildPath); // konsolepart.so is in ../autotests/ - if (buildPath.endsWith(QStringLiteral("/autotests"))) { + if (buildPath.endsWith(QLatin1String("/autotests"))) { buildPath.chop(10); } QCoreApplication::addLibraryPath(buildPath); diff --git a/src/main.cpp b/src/main.cpp index e62854f7..726ad802 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -279,13 +279,13 @@ bool shouldUseNewProcess(int argc, char *argv[]) // if users have explictly requested starting a new process // Support --nofork to retain argument compatibility with older // versions. - if (arguments.contains(QStringLiteral("--separate")) - || arguments.contains(QStringLiteral("--nofork"))) { + if (arguments.contains(QLatin1String("--separate")) + || arguments.contains(QLatin1String("--nofork"))) { return true; } // the only way to create new tab is to reuse existing Konsole process. - if (arguments.contains(QStringLiteral("--new-tab"))) { + if (arguments.contains(QLatin1String("--new-tab"))) { return false; } diff --git a/tools/uni2characterwidth/template.cpp b/tools/uni2characterwidth/template.cpp index 055d7a28..be2da424 100644 --- a/tools/uni2characterwidth/template.cpp +++ b/tools/uni2characterwidth/template.cpp @@ -124,7 +124,7 @@ static inline void warn(const Template::Element &element, const QString &msg) { void Template::executeCommand(Element &element, const Template::Element &childStub, const QStringList &argv) { // Insert content N times - if(argv[0] == QStringLiteral("repeat")) { + if(argv[0] == QLatin1String("repeat")) { bool ok; unsigned count = argv.value(1).toInt(&ok); if(!ok || count < 1) { @@ -148,7 +148,7 @@ void Template::executeCommand(Element &element, const Template::Element &childSt } // Set printf-like format (with leading %) applied for strings and numbers // inside the group - } else if(argv[0] == QStringLiteral("fmt")) { + } else if(argv[0] == QLatin1String("fmt")) { static const QRegularExpression FMT_RE(QStringLiteral(R":(^%[-0 +#]?(?:[1-9][0-9]*)?\.?[0-9]*[diouxXs]$):"), QRegularExpression::OptimizeOnFirstUsageOption); const auto match = FMT_RE.match(argv.value(1)); diff --git a/tools/uni2characterwidth/uni2characterwidth.cpp b/tools/uni2characterwidth/uni2characterwidth.cpp index 04d0b438..ed2bde4b 100644 --- a/tools/uni2characterwidth/uni2characterwidth.cpp +++ b/tools/uni2characterwidth/uni2characterwidth.cpp @@ -119,7 +119,7 @@ protected: continue; } if(!match.captured(QStringLiteral("udRangeInd")).isNull()) { - if(match.captured(QStringLiteral("udRangeInd")) == QStringLiteral("First")) { + if(match.captured(QStringLiteral("udRangeInd")) == QLatin1String("First")) { // Fetch next valid line, as it pairs with the current one to form a range QRegularExpressionMatch nlMatch; int firstLineNo = _lineNo; @@ -914,20 +914,20 @@ int main(int argc, char *argv[]) { {EmojiOpt, EmojiProperty::EmojiPresentation}, }; - if(emojiStr == QStringLiteral("presentation")) + if(emojiStr == QLatin1String("presentation")) convertOpts[EmojiOpt] = EmojiProperty::EmojiPresentation; - else if(emojiStr == QStringLiteral("all")) + else if(emojiStr == QLatin1String("all")) convertOpts[EmojiOpt] = EmojiProperty::Emoji; else { convertOpts[EmojiOpt] = EmojiProperty::EmojiPresentation; qWarning() << QStringLiteral("invalid emoji option value: %1. Assuming \"presentation\".").arg(emojiStr); } - if(ambiguousWidthStr == QStringLiteral("separate")) + if(ambiguousWidthStr == QLatin1String("separate")) convertOpts[AmbiguousWidthOpt] = CharacterWidth::Ambiguous; - else if(ambiguousWidthStr == QStringLiteral("1")) + else if(ambiguousWidthStr == QLatin1Char('1')) convertOpts[AmbiguousWidthOpt] = 1; - else if(ambiguousWidthStr == QStringLiteral("2")) + else if(ambiguousWidthStr == QLatin1Char('2')) convertOpts[AmbiguousWidthOpt] = 2; else { convertOpts[AmbiguousWidthOpt] = CharacterWidth::Ambiguous; @@ -940,7 +940,7 @@ int main(int argc, char *argv[]) { if(!GENERATOR_FUNCS_MAP.contains(generatorName)) { int status = 0; - if(generatorName != QStringLiteral("-")) { + if(generatorName != QLatin1String("-")) { status = 1; eout << QStringLiteral("Invalid output generator. Available generators:") << endl; }