Fix clazy warning: Use QString() multi-arg

No need to use arg(QString::number(int )), when arg() already has a int
overload.

Also replace "endl" with "Qt::endl".

GIT_SILENT
This commit is contained in:
Ahmad Samir 2021-08-22 15:15:16 +02:00
parent ac7eb252f1
commit 2c2469f991
10 changed files with 28 additions and 27 deletions

View file

@ -137,7 +137,7 @@ static QString deviceRow(LibInput::Device *device)
if (!device) {
return tableRow(i18n("Input Device"), i18nc("The input device of the event is not known", "Unknown"));
}
return tableRow(i18n("Input Device"), QStringLiteral("%1 (%2)").arg(device->name()).arg(device->sysName()));
return tableRow(i18n("Input Device"), QStringLiteral("%1 (%2)").arg(device->name(), device->sysName()));
}
static QString buttonsToString(Qt::MouseButtons buttons)

View file

@ -310,7 +310,7 @@ QString DecorationBridge::supportInformation() const
if (QLatin1String(property.name()) == QLatin1String("objectName")) {
continue;
}
b.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(settingsProperty(m_settings->property(property.name()))));
b.append(QStringLiteral("%1: %2\n").arg(property.name(), settingsProperty(m_settings->property(property.name()))));
}
}
return b;

View file

@ -50,10 +50,10 @@ void GeometryTip::setGeometry(const QRect& geom)
h = qMax(h, 0); // in case of isShade() and PBaseSize
const QString pos = QStringLiteral("%1,%2<br>(<b>%3&nbsp;x&nbsp;%4</b>)")
.arg(numberWithSign(geom.x()))
.arg(numberWithSign(geom.y()))
.arg(w)
.arg(h);
.arg(numberWithSign(geom.x()), //
numberWithSign(geom.y()),
QString::number(w),
QString::number(h));
setText(pos);
adjustSize();
move(geom.x() + ((geom.width() - width()) / 2),

View file

@ -62,7 +62,9 @@ int main(int argc, char **argv)
if (!path.isEmpty() && path == QStringLiteral("%1/metadata.desktop").arg(requestedTheme)) {
requestedTheme = QString("__aurorae__svg__").append(splitTheme.last());
themeResolved = true;
ts << i18n("Resolved %1 to the KWin Aurorae theme \"%2\", and will attempt to set that as your current theme.").arg(parser->positionalArguments().first()).arg(requestedTheme) << endl;
ts << i18n("Resolved %1 to the KWin Aurorae theme \"%2\", and will attempt to set that as your current theme.")
.arg(parser->positionalArguments().first(), requestedTheme)
<< Qt::endl;
}
}
} else {
@ -111,9 +113,9 @@ int main(int argc, char **argv)
const QString displayName = model->data(model->index(i), Qt::DisplayRole).toString();
const QString themeName = model->data(model->index(i), KDecoration2::Configuration::DecorationsModel::ThemeNameRole).toString();
if (settings->theme() == themeName) {
ts << QStringLiteral(" * %1 (theme name: %2 - current theme for this Plasma session)").arg(displayName).arg(themeName) << endl;
ts << QStringLiteral(" * %1 (theme name: %2 - current theme for this Plasma session)").arg(displayName, themeName) << Qt::endl;
} else {
ts << QStringLiteral(" * %1 (theme name: %2)").arg(displayName).arg(themeName) << endl;
ts << QStringLiteral(" * %1 (theme name: %2)").arg(displayName, themeName) << Qt::endl;
}
}
} else {

View file

@ -357,9 +357,9 @@ void X11WindowedBackend::grabKeyboard(xcb_timestamp_t time)
void X11WindowedBackend::updateWindowTitle()
{
const QString grab = m_keyboardGrabbed ? i18n("Press right control to ungrab input") : i18n("Press right control key to grab input");
const QString title = QStringLiteral("%1 (%2) - %3").arg(i18n("KDE Wayland Compositor"))
.arg(waylandServer()->socketName())
.arg(grab);
const QString title = QStringLiteral("%1 (%2) - %3").arg(i18n("KDE Wayland Compositor"),
waylandServer()->socketName(),
grab);
for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) {
(*it)->setWindowTitle(title);
}

View file

@ -78,8 +78,8 @@ void GenericScriptedConfig::createUi()
loader->setLanguageChangeEnabled(true);
QFile uiFile(uiPath);
// try getting a translation domain
const QString metaDataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QStringLiteral(KWIN_NAME"/%1/%2/metadata.desktop").arg(typeName()).arg(m_packageName));
const QString metaDataPath =
QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(KWIN_NAME "/%1/%2/metadata.desktop").arg(typeName(), m_packageName));
if (!metaDataPath.isNull()) {
KDesktopFile metaData(metaDataPath);
m_translator->setTranslationDomain(metaData.desktopGroup().readEntry("X-KWin-Config-TranslationDomain", QString()));

View file

@ -40,7 +40,7 @@ static KConfig *sessionConfig(QString id, QString key)
lastId = id;
lastKey = key;
if (!config) {
config = new KConfig(pattern.arg(id).arg(key), KConfig::SimpleConfig);
config = new KConfig(pattern.arg(id, key), KConfig::SimpleConfig);
}
return config;
}

View file

@ -216,10 +216,11 @@ void TabBoxHandlerPrivate::endHighlightWindows(bool abort)
QObject *TabBoxHandlerPrivate::createSwitcherItem(bool desktopMode)
{
// first try look'n'feel package
QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QStringLiteral("plasma/look-and-feel/%1/contents/%2")
.arg(config.layoutName())
.arg(desktopMode ? QStringLiteral("desktopswitcher/DesktopSwitcher.qml") : QStringLiteral("windowswitcher/WindowSwitcher.qml")));
QString file = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QStringLiteral("plasma/look-and-feel/%1/contents/%2")
.arg(config.layoutName(),
desktopMode ? QStringLiteral("desktopswitcher/DesktopSwitcher.qml") : QStringLiteral("windowswitcher/WindowSwitcher.qml")));
if (file.isNull()) {
const QString folderName = QLatin1String(KWIN_NAME) + (desktopMode ? QLatin1String("/desktoptabbox/") : QLatin1String("/tabbox/"));
auto findSwitcher = [this, desktopMode, folderName] {

View file

@ -159,8 +159,7 @@ void UserActionsMenu::helperDialog(const QString& message, AbstractClient* clien
QAction* action = Workspace::self()->findChild<QAction*>(name);
Q_ASSERT(action != nullptr);
const auto shortcuts = KGlobalAccel::self()->shortcut(action);
return QStringLiteral("%1 (%2)").arg(action->text())
.arg(shortcuts.isEmpty() ? QString() : shortcuts.first().toString(QKeySequence::NativeText));
return QStringLiteral("%1 (%2)").arg(action->text(), shortcuts.isEmpty() ? QString() : shortcuts.first().toString(QKeySequence::NativeText));
};
if (message == QStringLiteral("noborderaltf3")) {
args << QStringLiteral("--msgbox") << i18n(

View file

@ -1539,9 +1539,8 @@ QString Workspace::supportInformation() const
support.append(QStringLiteral("Protocol Version/Revision: %1/%2\n").arg(x11setup->protocol_major_version).arg(x11setup->protocol_minor_version));
const auto extensions = Xcb::Extensions::self()->extensions();
for (const auto &e : extensions) {
support.append(QStringLiteral("%1: %2; Version: 0x%3\n").arg(QString::fromUtf8(e.name))
.arg(e.present ? yes.trimmed() : no.trimmed())
.arg(QString::number(e.version, 16)));
support.append(QStringLiteral("%1: %2; Version: 0x%3\n")
.arg(QString::fromUtf8(e.name), e.present ? yes.trimmed() : no.trimmed(), QString::number(e.version, 16)));
}
support.append(QStringLiteral("\n"));
}
@ -1570,7 +1569,7 @@ QString Workspace::supportInformation() const
auto printProperty = [] (const QVariant &variant) {
if (variant.type() == QVariant::Size) {
const QSize &s = variant.toSize();
return QStringLiteral("%1x%2").arg(QString::number(s.width())).arg(QString::number(s.height()));
return QStringLiteral("%1x%2").arg(s.width()).arg(s.height());
}
if (QLatin1String(variant.typeName()) == QLatin1String("KWin::OpenGLPlatformInterface") ||
QLatin1String(variant.typeName()) == QLatin1String("KWin::Options::WindowOperation")) {
@ -1583,7 +1582,7 @@ QString Workspace::supportInformation() const
if (QLatin1String(property.name()) == QLatin1String("objectName")) {
continue;
}
support.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(printProperty(options->property(property.name()))));
support.append(QStringLiteral("%1: %2\n").arg(property.name(), printProperty(options->property(property.name()))));
}
support.append(QStringLiteral("\nScreen Edges\n"));
support.append(QStringLiteral( "============\n"));
@ -1593,7 +1592,7 @@ QString Workspace::supportInformation() const
if (QLatin1String(property.name()) == QLatin1String("objectName")) {
continue;
}
support.append(QStringLiteral("%1: %2\n").arg(property.name()).arg(printProperty(ScreenEdges::self()->property(property.name()))));
support.append(QStringLiteral("%1: %2\n").arg(property.name(), printProperty(ScreenEdges::self()->property(property.name()))));
}
support.append(QStringLiteral("\nScreens\n"));
support.append(QStringLiteral( "=======\n"));