plugins: Use QLatin1String::arg for faster and simpler string concatination

Using an infix with .arg() is simpler than having two string literals
This commit is contained in:
Alexander Lohnau 2023-08-12 13:26:05 +02:00 committed by Albert Vaca Cintora
parent 5e270fea2e
commit 69d6c17214
21 changed files with 21 additions and 21 deletions

View file

@ -124,7 +124,7 @@ void BatteryPlugin::receivePacket(const NetworkPacket &np)
QString BatteryPlugin::dbusPath() const 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" #include "batteryplugin.moc"

View file

@ -29,7 +29,7 @@ void BigscreenPlugin::receivePacket(const NetworkPacket &np)
QString BigscreenPlugin::dbusPath() const 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" #include "bigscreenplugin.moc"

View file

@ -28,7 +28,7 @@ void ClipboardPlugin::connected()
QString ClipboardPlugin::dbusPath() const 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) void ClipboardPlugin::clipboardChanged(const QString &content, ClipboardListener::ClipboardContentType contentType)

View file

@ -45,7 +45,7 @@ void ConnectivityReportPlugin::receivePacket(const NetworkPacket &np)
QString ConnectivityReportPlugin::dbusPath() const 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" #include "connectivity_reportplugin.moc"

View file

@ -186,7 +186,7 @@ bool ContactsPlugin::sendRequestWithIDs(const QString &packetType, const uIDList
QString ContactsPlugin::dbusPath() const 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" #include "contactsplugin.moc"

View file

@ -22,7 +22,7 @@ void FindMyPhonePlugin::ring()
QString FindMyPhonePlugin::dbusPath() const 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" #include "findmyphoneplugin.moc"

View file

@ -81,7 +81,7 @@ void FindThisDevicePlugin::receivePacket(const NetworkPacket & /*np*/)
QString FindThisDevicePlugin::dbusPath() const 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" #include "findthisdeviceplugin.moc"

View file

@ -91,7 +91,7 @@ void LockDevicePlugin::connected()
QString LockDevicePlugin::dbusPath() const 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" #include "lockdeviceplugin-win.moc"

View file

@ -125,7 +125,7 @@ void LockDevicePlugin::connected()
QString LockDevicePlugin::dbusPath() const 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" #include "lockdeviceplugin.moc"

View file

@ -67,7 +67,7 @@ long MprisRemotePlugin::position() const
QString MprisRemotePlugin::dbusPath() 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) void MprisRemotePlugin::requestPlayerStatus(const QString &player)

View file

@ -188,7 +188,7 @@ QString NotificationsPlugin::newId()
QString NotificationsPlugin::dbusPath() const 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" #include "moc_notificationsplugin.cpp"

View file

@ -42,7 +42,7 @@ void PhotoPlugin::requestPhoto(const QString &url)
QString PhotoPlugin::dbusPath() const 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" #include "moc_photoplugin.cpp"

View file

@ -46,7 +46,7 @@ void PingPlugin::sendPing(const QString &customMessage)
QString PingPlugin::dbusPath() const 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" #include "moc_pingplugin.cpp"

View file

@ -40,7 +40,7 @@ void RemoteCommandsPlugin::connected()
QString RemoteCommandsPlugin::dbusPath() const 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) void RemoteCommandsPlugin::setCommands(const QByteArray &cmds)

View file

@ -34,7 +34,7 @@ void RemoteControlPlugin::sendCommand(const QVariantMap &body)
QString RemoteControlPlugin::dbusPath() const 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" #include "moc_remotecontrolplugin.cpp"

View file

@ -120,7 +120,7 @@ int RemoteKeyboardPlugin::translateQtKey(int qtKey) const
QString RemoteKeyboardPlugin::dbusPath() 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" #include "moc_remotekeyboardplugin.cpp"

View file

@ -70,7 +70,7 @@ QByteArray RemoteSystemVolumePlugin::sinks()
QString RemoteSystemVolumePlugin::dbusPath() const 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" #include "moc_remotesystemvolumeplugin.cpp"

View file

@ -266,7 +266,7 @@ void SharePlugin::shareText(const QString &text)
QString SharePlugin::dbusPath() const 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" #include "moc_shareplugin.cpp"

View file

@ -231,7 +231,7 @@ Attachment SmsPlugin::createAttachmentFromUrl(const QString &url)
QString SmsPlugin::dbusPath() const 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() void SmsPlugin::launchApp()

View file

@ -91,7 +91,7 @@ void TelephonyPlugin::sendMutePacket()
QString TelephonyPlugin::dbusPath() const 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" #include "moc_telephonyplugin.cpp"

View file

@ -79,7 +79,7 @@ QString VirtualMonitorPlugin::dbusPath() const
if (QStandardPaths::findExecutable(QS("krfb-virtualmonitor")).isEmpty()) if (QStandardPaths::findExecutable(QS("krfb-virtualmonitor")).isEmpty())
return {}; return {};
return QS("/modules/kdeconnect/devices/") + device()->id() + QS("/virtualmonitor"); return QLatin1String("/modules/kdeconnect/devices/%1/virtualmonitor").arg(device()->id());
} }
bool VirtualMonitorPlugin::requestVirtualMonitor() bool VirtualMonitorPlugin::requestVirtualMonitor()