plugins: Prefer using statements with baseclass over empty constructor

Those plugins re really simple and don't need any initialization logic.
With the using statement, we do not need to add a constructor and pass the parent/args to the baseclass
This commit is contained in:
Alexander Lohnau 2023-07-28 10:36:48 +02:00
parent 4e3660ff0d
commit c5e7fdb5e4
24 changed files with 12 additions and 80 deletions

View file

@ -20,11 +20,6 @@ K_PLUGIN_CLASS_WITH_JSON(BigscreenPlugin, "kdeconnect_bigscreen.json")
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BIGSCREEN, "kdeconnect.plugin.bigscreen")
BigscreenPlugin::BigscreenPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void BigscreenPlugin::receivePacket(const NetworkPacket &np)
{
QString message = np.get<QString>(QStringLiteral("content"));

View file

@ -17,8 +17,7 @@ class BigscreenPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.bigscreen")
public:
explicit BigscreenPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
void receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override;

View file

@ -15,11 +15,6 @@
K_PLUGIN_CLASS_WITH_JSON(ConnectivityReportPlugin, "kdeconnect_connectivity_report.json")
ConnectivityReportPlugin::ConnectivityReportPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
QString ConnectivityReportPlugin::cellularNetworkType() const
{
return m_cellularNetworkType;

View file

@ -39,7 +39,7 @@ class ConnectivityReportPlugin : public KdeConnectPlugin
Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshed)
public:
explicit ConnectivityReportPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
void receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override;

View file

@ -14,11 +14,6 @@
K_PLUGIN_CLASS_WITH_JSON(FindMyPhonePlugin, "kdeconnect_findmyphone.json")
FindMyPhonePlugin::FindMyPhonePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void FindMyPhonePlugin::ring()
{
NetworkPacket np(PACKET_TYPE_FINDMYPHONE_REQUEST);

View file

@ -18,7 +18,7 @@ class FindMyPhonePlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findmyphone")
public:
explicit FindMyPhonePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
Q_SCRIPTABLE void ring();

View file

@ -26,11 +26,6 @@
K_PLUGIN_CLASS_WITH_JSON(FindThisDevicePlugin, "kdeconnect_findthisdevice.json")
FindThisDevicePlugin::FindThisDevicePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void FindThisDevicePlugin::receivePacket(const NetworkPacket & /*np*/)
{
const QString soundFile = config()->getString(QStringLiteral("ringtone"), defaultSound());

View file

@ -27,7 +27,7 @@ class FindThisDevicePlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findthisdevice")
public:
explicit FindThisDevicePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
QString dbusPath() const override;
void receivePacket(const NetworkPacket &np) override;

View file

@ -16,11 +16,6 @@
K_PLUGIN_CLASS_WITH_JSON(MprisRemotePlugin, "kdeconnect_mprisremote.json")
MprisRemotePlugin::MprisRemotePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void MprisRemotePlugin::receivePacket(const NetworkPacket &np)
{
if (np.type() != PACKET_TYPE_MPRIS)

View file

@ -31,7 +31,7 @@ class MprisRemotePlugin : public KdeConnectPlugin
Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChanged)
public:
explicit MprisRemotePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
long position() const;
int volume() const;

View file

@ -22,11 +22,6 @@
K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json")
NotificationsPlugin::NotificationsPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void NotificationsPlugin::connected()
{
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}});

View file

@ -20,7 +20,7 @@ class NotificationsPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.notifications")
public:
explicit NotificationsPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
void receivePacket(const NetworkPacket &np) override;
void connected() override;

View file

@ -15,11 +15,6 @@
K_PLUGIN_CLASS_WITH_JSON(PhotoPlugin, "kdeconnect_photo.json")
PhotoPlugin::PhotoPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void PhotoPlugin::receivePacket(const NetworkPacket &np)
{
if (np.get<bool>(QStringLiteral("cancel"))) {

View file

@ -19,7 +19,7 @@ class PhotoPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.photo")
public:
explicit PhotoPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
Q_SCRIPTABLE void requestPhoto(const QString &url);

View file

@ -19,17 +19,6 @@
K_PLUGIN_CLASS_WITH_JSON(PingPlugin, "kdeconnect_ping.json")
PingPlugin::PingPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
// qCDebug(KDECONNECT_PLUGIN_PING) << "Ping plugin constructor for device" << device()->name();
}
PingPlugin::~PingPlugin()
{
// qCDebug(KDECONNECT_PLUGIN_PING) << "Ping plugin destructor for device" << device()->name();
}
void PingPlugin::receivePacket(const NetworkPacket &np)
{
Daemon::instance()->sendSimpleNotification(QStringLiteral("pingReceived"),

View file

@ -18,8 +18,7 @@ class PingPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping")
public:
explicit PingPlugin(QObject *parent, const QVariantList &args);
~PingPlugin() override;
using KdeConnectPlugin::KdeConnectPlugin;
Q_SCRIPTABLE void sendPing();
Q_SCRIPTABLE void sendPing(const QString &customMessage);

View file

@ -18,11 +18,6 @@
K_PLUGIN_CLASS_WITH_JSON(RemoteControlPlugin, "kdeconnect_remotecontrol.json")
RemoteControlPlugin::RemoteControlPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void RemoteControlPlugin::moveCursor(const QPoint &p)
{
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {{QStringLiteral("dx"), p.x()}, {QStringLiteral("dy"), p.y()}});

View file

@ -18,7 +18,7 @@ class RemoteControlPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecontrol")
public:
explicit RemoteControlPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
QString dbusPath() const override;

View file

@ -21,11 +21,6 @@
K_PLUGIN_CLASS_WITH_JSON(RemoteSystemVolumePlugin, "kdeconnect_remotesystemvolume.json")
RemoteSystemVolumePlugin::RemoteSystemVolumePlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void RemoteSystemVolumePlugin::receivePacket(const NetworkPacket &np)
{
if (np.has(QStringLiteral("sinkList"))) {

View file

@ -21,7 +21,7 @@ class RemoteSystemVolumePlugin : public KdeConnectPlugin
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
public:
explicit RemoteSystemVolumePlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
void receivePacket(const NetworkPacket &np) override;
void connected() override;

View file

@ -17,11 +17,6 @@
K_PLUGIN_CLASS_WITH_JSON(TelephonyPlugin, "kdeconnect_telephony.json")
TelephonyPlugin::TelephonyPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
void TelephonyPlugin::createNotification(const NetworkPacket &np)
{
const QString event = np.get<QString>(QStringLiteral("event"));

View file

@ -35,7 +35,7 @@ class TelephonyPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.telephony")
public:
explicit TelephonyPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
void receivePacket(const NetworkPacket &np) override;
QString dbusPath() const override;

View file

@ -19,11 +19,6 @@
K_PLUGIN_CLASS_WITH_JSON(VirtualMonitorPlugin, "kdeconnect_virtualmonitor.json")
#define QS QLatin1String
VirtualMonitorPlugin::VirtualMonitorPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
{
}
VirtualMonitorPlugin::~VirtualMonitorPlugin()
{
stop();

View file

@ -21,7 +21,7 @@ class VirtualMonitorPlugin : public KdeConnectPlugin
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.virtualmonitor")
public:
explicit VirtualMonitorPlugin(QObject *parent, const QVariantList &args);
using KdeConnectPlugin::KdeConnectPlugin;
~VirtualMonitorPlugin() override;
Q_SCRIPTABLE bool requestVirtualMonitor();