diff --git a/src/capture/widget/capturebutton.cpp b/src/capture/widget/capturebutton.cpp index 0a40b9d3..b894fc09 100644 --- a/src/capture/widget/capturebutton.cpp +++ b/src/capture/widget/capturebutton.cpp @@ -125,7 +125,7 @@ QString CaptureButton::styleSheet() const { // get icon returns the icon for the type of button QIcon CaptureButton::icon() const { QString color(iconIsWhiteByColor(m_mainColor) ? "White" : "Black"); - QString iconPath = QString(":/img/buttonIcons%1/%2") + QString iconPath = QStringLiteral(":/img/buttonIcons%1/%2") .arg(color).arg(m_tool->iconName()); return QIcon(iconPath); } diff --git a/src/capture/widget/capturewidget.cpp b/src/capture/widget/capturewidget.cpp index c7cd878b..d22341e7 100644 --- a/src/capture/widget/capturewidget.cpp +++ b/src/capture/widget/capturewidget.cpp @@ -592,7 +592,7 @@ void CaptureWidget::updateSizeIndicator() { // The grabbed region is everything which is covered by the drawn // rectangles (border included, that's the reason of the +2). if (m_sizeIndButton){ - m_sizeIndButton->setText(QString("%1\n%2") + m_sizeIndButton->setText(QStringLiteral("%1\n%2") .arg(m_selection.width()+2) .arg(m_selection.height()+2)); } diff --git a/src/capture/workers/imgur/imagelabel.cpp b/src/capture/workers/imgur/imagelabel.cpp index 9aaaa26d..5b2fb62c 100644 --- a/src/capture/workers/imgur/imagelabel.cpp +++ b/src/capture/workers/imgur/imagelabel.cpp @@ -37,7 +37,7 @@ ImageLabel::ImageLabel(QWidget *parent): void ImageLabel::setScreenshot(const QPixmap &pixmap) { m_pixmap = pixmap; - const QString tooltip = QString("%1x%2 px").arg(m_pixmap.width()) + const QString tooltip = QStringLiteral("%1x%2 px").arg(m_pixmap.width()) .arg(m_pixmap.height()); setToolTip(tooltip); setScaledPixmap(); diff --git a/src/capture/workers/imgur/imguruploader.cpp b/src/capture/workers/imgur/imguruploader.cpp index 664b9b5c..f0f98614 100644 --- a/src/capture/workers/imgur/imguruploader.cpp +++ b/src/capture/workers/imgur/imguruploader.cpp @@ -70,7 +70,7 @@ void ImgurUploader::handleReply(QNetworkReply *reply) { if (reply->error() == QNetworkReply::NoError) { QString data = QString::fromUtf8(reply->readAll()); QString imageID = data.split("\"").at(5); - QString url = QString("http://i.imgur.com/%1.png").arg(imageID); + QString url = QStringLiteral("http://i.imgur.com/%1.png").arg(imageID); m_imageURL.setUrl(url); onUploadOk(); } else { diff --git a/src/cli/commandlineparser.cpp b/src/cli/commandlineparser.cpp index d9dfba1e..49ed385e 100644 --- a/src/cli/commandlineparser.cpp +++ b/src/cli/commandlineparser.cpp @@ -40,8 +40,8 @@ QStringList addDashToOptionNames(const QStringList &names) { for (const QString &name: names) { // prepend "-" to single character options, and "--" to the others QString dashedName = (name.length() == 1) ? - QString("-%1").arg(name) : - QString("--%1").arg(name); + QStringLiteral("-%1").arg(name) : + QStringLiteral("--%1").arg(name); dashedNames << dashedName; } return dashedNames; @@ -57,7 +57,7 @@ QString optionsToString(const QList &options, QStringList dashedOptions = addDashToOptionNames(option.names()); QString joinedDashedOptions = dashedOptions.join(", "); if (!option.valueName().isEmpty()) { - joinedDashedOptions += QString(" <%1>") + joinedDashedOptions += QStringLiteral(" <%1>") .arg(option.valueName()); } if (joinedDashedOptions.length() > size) { @@ -75,7 +75,7 @@ QString optionsToString(const QList &options, if(!dashedOptionList.isEmpty()) { result += "Options:\n"; for (int i = 0; i < options.length(); ++i) { - result += QString(" %1 %2\n") + result += QStringLiteral(" %1 %2\n") .arg(dashedOptionList.at(i).leftJustified(size, ' ')) .arg(options.at(i).description()); } @@ -87,7 +87,7 @@ QString optionsToString(const QList &options, result += "Arguments:\n"; } for (int i = 0; i < arguments.length(); ++i) { - result += QString(" %1 %2\n") + result += QStringLiteral(" %1 %2\n") .arg(arguments.at(i).name().leftJustified(size, ' ')) .arg(arguments.at(i).description()); } @@ -119,7 +119,7 @@ bool CommandLineParser::processArgs(const QStringList &args, --actualIt; } else { ok = false; - out << QString("'%1' is not a valid argument.").arg(argument); + out << QStringLiteral("'%1' is not a valid argument.").arg(argument); } return ok; } @@ -142,7 +142,7 @@ bool CommandLineParser::processOptions(const QStringList &args, ok = isDoubleDashed ? arg.length() > 3 : arg.length() == 2; if (!ok) { - out << QString("the option %1 has a wrong format.").arg(arg); + out << QStringLiteral("the option %1 has a wrong format.").arg(arg); return ok; } arg = isDoubleDashed ? @@ -162,7 +162,7 @@ bool CommandLineParser::processOptions(const QStringList &args, if (argName.isEmpty()) { argName = qApp->applicationName(); } - out << QString("the option '%1' is not a valid option " + out << QStringLiteral("the option '%1' is not a valid option " "for the argument '%2'.").arg(arg) .arg(argName); ok = false; @@ -172,7 +172,7 @@ bool CommandLineParser::processOptions(const QStringList &args, CommandOption option = *optionIt; bool requiresValue = !(option.valueName().isEmpty()); if (!requiresValue && equalsPos != -1) { - out << QString("the option '%1' contains a '=' and it doesn't " + out << QStringLiteral("the option '%1' contains a '=' and it doesn't " "require a value.").arg(arg); ok = false; return ok; @@ -181,7 +181,7 @@ bool CommandLineParser::processOptions(const QStringList &args, if (actualIt+1 != args.cend()) { ++actualIt; } else { - out << QString("Expected value after the option '%1'.").arg(arg); + out << QStringLiteral("Expected value after the option '%1'.").arg(arg); ok = false; return ok; } @@ -237,7 +237,7 @@ bool CommandLineParser::parse(const QStringList &args) { } } if (!ok && !m_generalErrorMessage.isEmpty()) { - out << QString(" %1\n").arg(m_generalErrorMessage); + out << QStringLiteral(" %1\n").arg(m_generalErrorMessage); } return ok; } @@ -335,7 +335,8 @@ void CommandLineParser::printHelp(QStringList args, const Node *node) { argName = qApp->applicationName(); } QString argText = node->subNodes.isEmpty() ? "" : "[arguments]"; - helpText += QString("Usage: %1 [%2-options] %3\n\n").arg(args.join(" ")) + helpText += QStringLiteral("Usage: %1 [%2-options] %3\n\n") + .arg(args.join(" ")) .arg(argName).arg(argText); // add command options and subarguments QList subArgs; diff --git a/src/config/buttonlistview.cpp b/src/config/buttonlistview.cpp index f5c418e0..dc6babc9 100644 --- a/src/config/buttonlistview.cpp +++ b/src/config/buttonlistview.cpp @@ -47,10 +47,10 @@ void ButtonListView::initButtonList() { // when the background is lighter than gray, it uses the white icons QColor bgColor = this->palette().color(QWidget::backgroundRole()); QString color = bgColor.valueF() < 0.6 ? "White" : "Black"; - QString iconPath = QString(":/img/buttonIcons%1/%2") + QString iconPath = QStringLiteral(":/img/buttonIcons%1/%2") .arg(color).arg(tool->iconName()); if (t == CaptureButton::TYPE_SELECTIONINDICATOR) { - iconPath = QString(":/img/buttonIcons%1/size_indicator.png") + iconPath = QStringLiteral(":/img/buttonIcons%1/size_indicator.png") .arg(color); } m_buttonItem->setIcon(QIcon(iconPath)); diff --git a/src/config/filenameeditor.cpp b/src/config/filenameeditor.cpp index 5e8b8b1b..4b12b62d 100644 --- a/src/config/filenameeditor.cpp +++ b/src/config/filenameeditor.cpp @@ -59,7 +59,7 @@ void FileNameEditor::initWidgets() { m_outputLabel = new QLineEdit(this); m_outputLabel->setDisabled(true); QString foreground = this->palette().foreground().color().name(); - m_outputLabel->setStyleSheet(QString("color: %1").arg(foreground)); + m_outputLabel->setStyleSheet(QStringLiteral("color: %1").arg(foreground)); QPalette pal = m_outputLabel->palette(); QColor color = pal.color(QPalette::Disabled, m_outputLabel->backgroundRole()); pal.setColor(QPalette::Active, m_outputLabel->backgroundRole(), color); diff --git a/src/main.cpp b/src/main.cpp index 22ae776a..b6b96d04 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -265,9 +265,10 @@ int main(int argc, char *argv[]) { QString newFilename(parser.value(filenameOption)); config.setFilenamePattern(newFilename); FileNameHandler fh; - QTextStream(stdout) << QString("The new pattern is '%1'\n" - "Parsed pattern example: %2\n").arg(newFilename) - .arg(fh.parsedPattern()); + QTextStream(stdout) + << QStringLiteral("The new pattern is '%1'\n" + "Parsed pattern example: %2\n").arg(newFilename) + .arg(fh.parsedPattern()); } if (tray) { QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", diff --git a/src/utils/desktopfileparse.cpp b/src/utils/desktopfileparse.cpp index 7843048a..e531f48b 100644 --- a/src/utils/desktopfileparse.cpp +++ b/src/utils/desktopfileparse.cpp @@ -25,10 +25,10 @@ DesktopFileParser::DesktopFileParser() { QString locale = QLocale().name(); QString localeShort = QLocale().name().left(2); - m_localeName = QString("Name[%1]").arg(locale); - m_localeDescription = QString("Comment[%1]").arg(locale); - m_localeNameShort = QString("Name[%1]").arg(localeShort); - m_localeDescriptionShort = QString("Comment[%1]") + m_localeName = QStringLiteral("Name[%1]").arg(locale); + m_localeDescription = QStringLiteral("Comment[%1]").arg(locale); + m_localeNameShort = QStringLiteral("Name[%1]").arg(localeShort); + m_localeDescriptionShort = QStringLiteral("Comment[%1]") .arg(localeShort); m_defaultIcon = QIcon::fromTheme("application-x-executable"); } diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 40725cff..6df30d4d 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -6,9 +6,9 @@ #include SystemNotification::SystemNotification(QObject *parent) : QObject(parent) { - m_interface = new QDBusInterface("org.freedesktop.Notifications", - "/org/freedesktop/Notifications", - "org.freedesktop.Notifications", + m_interface = new QDBusInterface(QStringLiteral("org.freedesktop.Notifications"), + QStringLiteral("/org/freedesktop/Notifications"), + QStringLiteral("org.freedesktop.Notifications"), QDBusConnection::sessionBus(), this); }