From 69d6c172142dbec0db4251ecb0aa0ecc2d194193 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 12 Aug 2023 13:26:05 +0200 Subject: [PATCH] plugins: Use QLatin1String::arg for faster and simpler string concatination Using an infix with .arg() is simpler than having two string literals --- plugins/battery/batteryplugin.cpp | 2 +- plugins/bigscreen/bigscreenplugin.cpp | 2 +- plugins/clipboard/clipboardplugin.cpp | 2 +- plugins/connectivity-report/connectivity_reportplugin.cpp | 2 +- plugins/contacts/contactsplugin.cpp | 2 +- plugins/findmyphone/findmyphoneplugin.cpp | 2 +- plugins/findthisdevice/findthisdeviceplugin.cpp | 2 +- plugins/lockdevice/lockdeviceplugin-win.cpp | 2 +- plugins/lockdevice/lockdeviceplugin.cpp | 2 +- plugins/mprisremote/mprisremoteplugin.cpp | 2 +- plugins/notifications/notificationsplugin.cpp | 2 +- plugins/photo/photoplugin.cpp | 2 +- plugins/ping/pingplugin.cpp | 2 +- plugins/remotecommands/remotecommandsplugin.cpp | 2 +- plugins/remotecontrol/remotecontrolplugin.cpp | 2 +- plugins/remotekeyboard/remotekeyboardplugin.cpp | 2 +- plugins/remotesystemvolume/remotesystemvolumeplugin.cpp | 2 +- plugins/share/shareplugin.cpp | 2 +- plugins/sms/smsplugin.cpp | 2 +- plugins/telephony/telephonyplugin.cpp | 2 +- plugins/virtualmonitor/virtualmonitorplugin.cpp | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/plugins/battery/batteryplugin.cpp b/plugins/battery/batteryplugin.cpp index fcf395c9c..2258a62a7 100644 --- a/plugins/battery/batteryplugin.cpp +++ b/plugins/battery/batteryplugin.cpp @@ -124,7 +124,7 @@ void BatteryPlugin::receivePacket(const NetworkPacket &np) QString BatteryPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/battery"); + return QLatin1String("/modules/kdeconnect/devices/%1/battery").arg(device()->id()); } #include "batteryplugin.moc" diff --git a/plugins/bigscreen/bigscreenplugin.cpp b/plugins/bigscreen/bigscreenplugin.cpp index c4c739f7f..40dd5a850 100644 --- a/plugins/bigscreen/bigscreenplugin.cpp +++ b/plugins/bigscreen/bigscreenplugin.cpp @@ -29,7 +29,7 @@ void BigscreenPlugin::receivePacket(const NetworkPacket &np) QString BigscreenPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/bigscreen"); + return QLatin1String("/modules/kdeconnect/devices/%1/bigscreen").arg(device()->id()); } #include "bigscreenplugin.moc" diff --git a/plugins/clipboard/clipboardplugin.cpp b/plugins/clipboard/clipboardplugin.cpp index 7b1685079..ccc892e60 100644 --- a/plugins/clipboard/clipboardplugin.cpp +++ b/plugins/clipboard/clipboardplugin.cpp @@ -28,7 +28,7 @@ void ClipboardPlugin::connected() QString ClipboardPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/clipboard"); + return QLatin1String("/modules/kdeconnect/devices/%1/clipboard").arg(device()->id()); } void ClipboardPlugin::clipboardChanged(const QString &content, ClipboardListener::ClipboardContentType contentType) diff --git a/plugins/connectivity-report/connectivity_reportplugin.cpp b/plugins/connectivity-report/connectivity_reportplugin.cpp index efb6fd51d..43ad3b450 100644 --- a/plugins/connectivity-report/connectivity_reportplugin.cpp +++ b/plugins/connectivity-report/connectivity_reportplugin.cpp @@ -45,7 +45,7 @@ void ConnectivityReportPlugin::receivePacket(const NetworkPacket &np) QString ConnectivityReportPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/connectivity_report"); + return QLatin1String("/modules/kdeconnect/devices/%1/connectivity_report").arg(device()->id()); } #include "connectivity_reportplugin.moc" diff --git a/plugins/contacts/contactsplugin.cpp b/plugins/contacts/contactsplugin.cpp index a2a901ec0..2f542eb46 100644 --- a/plugins/contacts/contactsplugin.cpp +++ b/plugins/contacts/contactsplugin.cpp @@ -186,7 +186,7 @@ bool ContactsPlugin::sendRequestWithIDs(const QString &packetType, const uIDList QString ContactsPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/contacts"); + return QLatin1String("/modules/kdeconnect/devices/%1/contacts").arg(device()->id()); } #include "contactsplugin.moc" diff --git a/plugins/findmyphone/findmyphoneplugin.cpp b/plugins/findmyphone/findmyphoneplugin.cpp index f3e6aa936..699e0fe95 100644 --- a/plugins/findmyphone/findmyphoneplugin.cpp +++ b/plugins/findmyphone/findmyphoneplugin.cpp @@ -22,7 +22,7 @@ void FindMyPhonePlugin::ring() QString FindMyPhonePlugin::dbusPath() const { - return QLatin1String("/modules/kdeconnect/devices/") + device()->id() + QLatin1String("/findmyphone"); + return QLatin1String("/modules/kdeconnect/devices/%1/findmyphone").arg(device()->id()); } #include "findmyphoneplugin.moc" diff --git a/plugins/findthisdevice/findthisdeviceplugin.cpp b/plugins/findthisdevice/findthisdeviceplugin.cpp index dfc692414..fcaa4bfb8 100644 --- a/plugins/findthisdevice/findthisdeviceplugin.cpp +++ b/plugins/findthisdevice/findthisdeviceplugin.cpp @@ -81,7 +81,7 @@ void FindThisDevicePlugin::receivePacket(const NetworkPacket & /*np*/) QString FindThisDevicePlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/findthisdevice"); + return QLatin1String("/modules/kdeconnect/devices/%1/findthisdevice").arg(device()->id()); } #include "findthisdeviceplugin.moc" diff --git a/plugins/lockdevice/lockdeviceplugin-win.cpp b/plugins/lockdevice/lockdeviceplugin-win.cpp index 6c7cf9647..ca6211c17 100644 --- a/plugins/lockdevice/lockdeviceplugin-win.cpp +++ b/plugins/lockdevice/lockdeviceplugin-win.cpp @@ -91,7 +91,7 @@ void LockDevicePlugin::connected() QString LockDevicePlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/lockdevice"); + return QLatin1String("/modules/kdeconnect/devices/%1/lockdevice").arg(device()->id()); } #include "lockdeviceplugin-win.moc" diff --git a/plugins/lockdevice/lockdeviceplugin.cpp b/plugins/lockdevice/lockdeviceplugin.cpp index 282596353..6fdfe68f6 100644 --- a/plugins/lockdevice/lockdeviceplugin.cpp +++ b/plugins/lockdevice/lockdeviceplugin.cpp @@ -125,7 +125,7 @@ void LockDevicePlugin::connected() QString LockDevicePlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/lockdevice"); + return QLatin1String("/modules/kdeconnect/devices/%1/lockdevice").arg(device()->id()); } #include "lockdeviceplugin.moc" diff --git a/plugins/mprisremote/mprisremoteplugin.cpp b/plugins/mprisremote/mprisremoteplugin.cpp index bc4a0ed7f..5bfe8a56f 100644 --- a/plugins/mprisremote/mprisremoteplugin.cpp +++ b/plugins/mprisremote/mprisremoteplugin.cpp @@ -67,7 +67,7 @@ long MprisRemotePlugin::position() const QString MprisRemotePlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/mprisremote"); + return QLatin1String("/modules/kdeconnect/devices/%1/mprisremote").arg(device()->id()); } void MprisRemotePlugin::requestPlayerStatus(const QString &player) diff --git a/plugins/notifications/notificationsplugin.cpp b/plugins/notifications/notificationsplugin.cpp index 925f8e00e..07f0d6d94 100644 --- a/plugins/notifications/notificationsplugin.cpp +++ b/plugins/notifications/notificationsplugin.cpp @@ -188,7 +188,7 @@ QString NotificationsPlugin::newId() QString NotificationsPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/notifications"); + return QLatin1String("/modules/kdeconnect/devices/%1/notifications").arg(device()->id()); } #include "moc_notificationsplugin.cpp" diff --git a/plugins/photo/photoplugin.cpp b/plugins/photo/photoplugin.cpp index 1a7a26aa8..85264c12c 100644 --- a/plugins/photo/photoplugin.cpp +++ b/plugins/photo/photoplugin.cpp @@ -42,7 +42,7 @@ void PhotoPlugin::requestPhoto(const QString &url) QString PhotoPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/photo"); + return QLatin1String("/modules/kdeconnect/devices/%1/photo").arg(device()->id()); } #include "moc_photoplugin.cpp" diff --git a/plugins/ping/pingplugin.cpp b/plugins/ping/pingplugin.cpp index b6d50ead4..9471fc9f8 100644 --- a/plugins/ping/pingplugin.cpp +++ b/plugins/ping/pingplugin.cpp @@ -46,7 +46,7 @@ void PingPlugin::sendPing(const QString &customMessage) QString PingPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/ping"); + return QLatin1String("/modules/kdeconnect/devices/%1/ping").arg(device()->id()); } #include "moc_pingplugin.cpp" diff --git a/plugins/remotecommands/remotecommandsplugin.cpp b/plugins/remotecommands/remotecommandsplugin.cpp index 136bee09a..5cb045455 100644 --- a/plugins/remotecommands/remotecommandsplugin.cpp +++ b/plugins/remotecommands/remotecommandsplugin.cpp @@ -40,7 +40,7 @@ void RemoteCommandsPlugin::connected() QString RemoteCommandsPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecommands"); + return QLatin1String("/modules/kdeconnect/devices/%1/remotecommands").arg(device()->id()); } void RemoteCommandsPlugin::setCommands(const QByteArray &cmds) diff --git a/plugins/remotecontrol/remotecontrolplugin.cpp b/plugins/remotecontrol/remotecontrolplugin.cpp index 28418d2bd..149c59166 100644 --- a/plugins/remotecontrol/remotecontrolplugin.cpp +++ b/plugins/remotecontrol/remotecontrolplugin.cpp @@ -34,7 +34,7 @@ void RemoteControlPlugin::sendCommand(const QVariantMap &body) QString RemoteControlPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotecontrol"); + return QLatin1String("/modules/kdeconnect/devices/%1/remotecontrol").arg(device()->id()); } #include "moc_remotecontrolplugin.cpp" diff --git a/plugins/remotekeyboard/remotekeyboardplugin.cpp b/plugins/remotekeyboard/remotekeyboardplugin.cpp index 94a20b455..55beec80f 100644 --- a/plugins/remotekeyboard/remotekeyboardplugin.cpp +++ b/plugins/remotekeyboard/remotekeyboardplugin.cpp @@ -120,7 +120,7 @@ int RemoteKeyboardPlugin::translateQtKey(int qtKey) const QString RemoteKeyboardPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotekeyboard"); + return QLatin1String("/modules/kdeconnect/devices/%1/remotekeyboard").arg(device()->id()); } #include "moc_remotekeyboardplugin.cpp" diff --git a/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp b/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp index 69e994ae9..a7a5406bd 100644 --- a/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp +++ b/plugins/remotesystemvolume/remotesystemvolumeplugin.cpp @@ -70,7 +70,7 @@ QByteArray RemoteSystemVolumePlugin::sinks() QString RemoteSystemVolumePlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/remotesystemvolume"); + return QLatin1String("/modules/kdeconnect/devices/%1/remotesystemvolume").arg(device()->id()); } #include "moc_remotesystemvolumeplugin.cpp" diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index f87a64828..a14774fa0 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -266,7 +266,7 @@ void SharePlugin::shareText(const QString &text) QString SharePlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/share"); + return QLatin1String("/modules/kdeconnect/devices/%1/share").arg(device()->id()); } #include "moc_shareplugin.cpp" diff --git a/plugins/sms/smsplugin.cpp b/plugins/sms/smsplugin.cpp index 820eda6b9..493951d9e 100644 --- a/plugins/sms/smsplugin.cpp +++ b/plugins/sms/smsplugin.cpp @@ -231,7 +231,7 @@ Attachment SmsPlugin::createAttachmentFromUrl(const QString &url) QString SmsPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/sms"); + return QLatin1String("/modules/kdeconnect/devices/%1/sms").arg(device()->id()); } void SmsPlugin::launchApp() diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index c1094e783..1e5a72936 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -91,7 +91,7 @@ void TelephonyPlugin::sendMutePacket() QString TelephonyPlugin::dbusPath() const { - return QStringLiteral("/modules/kdeconnect/devices/") + device()->id() + QStringLiteral("/telephony"); + return QLatin1String("/modules/kdeconnect/devices/%1/telepony").arg(device()->id()); } #include "moc_telephonyplugin.cpp" diff --git a/plugins/virtualmonitor/virtualmonitorplugin.cpp b/plugins/virtualmonitor/virtualmonitorplugin.cpp index 9922be927..38788867f 100644 --- a/plugins/virtualmonitor/virtualmonitorplugin.cpp +++ b/plugins/virtualmonitor/virtualmonitorplugin.cpp @@ -79,7 +79,7 @@ QString VirtualMonitorPlugin::dbusPath() const if (QStandardPaths::findExecutable(QS("krfb-virtualmonitor")).isEmpty()) return {}; - return QS("/modules/kdeconnect/devices/") + device()->id() + QS("/virtualmonitor"); + return QLatin1String("/modules/kdeconnect/devices/%1/virtualmonitor").arg(device()->id()); } bool VirtualMonitorPlugin::requestVirtualMonitor()