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:
parent
4e3660ff0d
commit
c5e7fdb5e4
24 changed files with 12 additions and 80 deletions
|
@ -20,11 +20,6 @@ K_PLUGIN_CLASS_WITH_JSON(BigscreenPlugin, "kdeconnect_bigscreen.json")
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_BIGSCREEN, "kdeconnect.plugin.bigscreen")
|
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)
|
void BigscreenPlugin::receivePacket(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
QString message = np.get<QString>(QStringLiteral("content"));
|
QString message = np.get<QString>(QStringLiteral("content"));
|
||||||
|
|
|
@ -17,8 +17,7 @@ class BigscreenPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.bigscreen")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.bigscreen")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BigscreenPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
QString dbusPath() const override;
|
QString dbusPath() const override;
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(ConnectivityReportPlugin, "kdeconnect_connectivity_report.json")
|
K_PLUGIN_CLASS_WITH_JSON(ConnectivityReportPlugin, "kdeconnect_connectivity_report.json")
|
||||||
|
|
||||||
ConnectivityReportPlugin::ConnectivityReportPlugin(QObject *parent, const QVariantList &args)
|
|
||||||
: KdeConnectPlugin(parent, args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ConnectivityReportPlugin::cellularNetworkType() const
|
QString ConnectivityReportPlugin::cellularNetworkType() const
|
||||||
{
|
{
|
||||||
return m_cellularNetworkType;
|
return m_cellularNetworkType;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ConnectivityReportPlugin : public KdeConnectPlugin
|
||||||
Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshed)
|
Q_PROPERTY(int cellularNetworkStrength READ cellularNetworkStrength NOTIFY refreshed)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConnectivityReportPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
QString dbusPath() const override;
|
QString dbusPath() const override;
|
||||||
|
|
|
@ -14,11 +14,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(FindMyPhonePlugin, "kdeconnect_findmyphone.json")
|
K_PLUGIN_CLASS_WITH_JSON(FindMyPhonePlugin, "kdeconnect_findmyphone.json")
|
||||||
|
|
||||||
FindMyPhonePlugin::FindMyPhonePlugin(QObject *parent, const QVariantList &args)
|
|
||||||
: KdeConnectPlugin(parent, args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void FindMyPhonePlugin::ring()
|
void FindMyPhonePlugin::ring()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_FINDMYPHONE_REQUEST);
|
NetworkPacket np(PACKET_TYPE_FINDMYPHONE_REQUEST);
|
||||||
|
|
|
@ -18,7 +18,7 @@ class FindMyPhonePlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findmyphone")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findmyphone")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FindMyPhonePlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
Q_SCRIPTABLE void ring();
|
Q_SCRIPTABLE void ring();
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(FindThisDevicePlugin, "kdeconnect_findthisdevice.json")
|
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*/)
|
void FindThisDevicePlugin::receivePacket(const NetworkPacket & /*np*/)
|
||||||
{
|
{
|
||||||
const QString soundFile = config()->getString(QStringLiteral("ringtone"), defaultSound());
|
const QString soundFile = config()->getString(QStringLiteral("ringtone"), defaultSound());
|
||||||
|
|
|
@ -27,7 +27,7 @@ class FindThisDevicePlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findthisdevice")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.findthisdevice")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FindThisDevicePlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
QString dbusPath() const override;
|
QString dbusPath() const override;
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
|
|
|
@ -16,11 +16,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(MprisRemotePlugin, "kdeconnect_mprisremote.json")
|
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)
|
void MprisRemotePlugin::receivePacket(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
if (np.type() != PACKET_TYPE_MPRIS)
|
if (np.type() != PACKET_TYPE_MPRIS)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class MprisRemotePlugin : public KdeConnectPlugin
|
||||||
Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChanged)
|
Q_PROPERTY(bool canSeek READ canSeek NOTIFY propertiesChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MprisRemotePlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
long position() const;
|
long position() const;
|
||||||
int volume() const;
|
int volume() const;
|
||||||
|
|
|
@ -22,11 +22,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json")
|
K_PLUGIN_CLASS_WITH_JSON(NotificationsPlugin, "kdeconnect_notifications.json")
|
||||||
|
|
||||||
NotificationsPlugin::NotificationsPlugin(QObject *parent, const QVariantList &args)
|
|
||||||
: KdeConnectPlugin(parent, args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void NotificationsPlugin::connected()
|
void NotificationsPlugin::connected()
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}});
|
NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{QStringLiteral("request"), true}});
|
||||||
|
|
|
@ -20,7 +20,7 @@ class NotificationsPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.notifications")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.notifications")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NotificationsPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
void connected() override;
|
void connected() override;
|
||||||
|
|
|
@ -15,11 +15,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(PhotoPlugin, "kdeconnect_photo.json")
|
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)
|
void PhotoPlugin::receivePacket(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
if (np.get<bool>(QStringLiteral("cancel"))) {
|
if (np.get<bool>(QStringLiteral("cancel"))) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PhotoPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.photo")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.photo")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PhotoPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
Q_SCRIPTABLE void requestPhoto(const QString &url);
|
Q_SCRIPTABLE void requestPhoto(const QString &url);
|
||||||
|
|
||||||
|
|
|
@ -19,17 +19,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(PingPlugin, "kdeconnect_ping.json")
|
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)
|
void PingPlugin::receivePacket(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
Daemon::instance()->sendSimpleNotification(QStringLiteral("pingReceived"),
|
Daemon::instance()->sendSimpleNotification(QStringLiteral("pingReceived"),
|
||||||
|
|
|
@ -18,8 +18,7 @@ class PingPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PingPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
~PingPlugin() override;
|
|
||||||
|
|
||||||
Q_SCRIPTABLE void sendPing();
|
Q_SCRIPTABLE void sendPing();
|
||||||
Q_SCRIPTABLE void sendPing(const QString &customMessage);
|
Q_SCRIPTABLE void sendPing(const QString &customMessage);
|
||||||
|
|
|
@ -18,11 +18,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(RemoteControlPlugin, "kdeconnect_remotecontrol.json")
|
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)
|
void RemoteControlPlugin::moveCursor(const QPoint &p)
|
||||||
{
|
{
|
||||||
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {{QStringLiteral("dx"), p.x()}, {QStringLiteral("dy"), p.y()}});
|
NetworkPacket np(PACKET_TYPE_MOUSEPAD_REQUEST, {{QStringLiteral("dx"), p.x()}, {QStringLiteral("dy"), p.y()}});
|
||||||
|
|
|
@ -18,7 +18,7 @@ class RemoteControlPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecontrol")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.remotecontrol")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RemoteControlPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
QString dbusPath() const override;
|
QString dbusPath() const override;
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(RemoteSystemVolumePlugin, "kdeconnect_remotesystemvolume.json")
|
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)
|
void RemoteSystemVolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
if (np.has(QStringLiteral("sinkList"))) {
|
if (np.has(QStringLiteral("sinkList"))) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RemoteSystemVolumePlugin : public KdeConnectPlugin
|
||||||
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
|
Q_PROPERTY(QString deviceId READ deviceId CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RemoteSystemVolumePlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
void connected() override;
|
void connected() override;
|
||||||
|
|
|
@ -17,11 +17,6 @@
|
||||||
|
|
||||||
K_PLUGIN_CLASS_WITH_JSON(TelephonyPlugin, "kdeconnect_telephony.json")
|
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)
|
void TelephonyPlugin::createNotification(const NetworkPacket &np)
|
||||||
{
|
{
|
||||||
const QString event = np.get<QString>(QStringLiteral("event"));
|
const QString event = np.get<QString>(QStringLiteral("event"));
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TelephonyPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.telephony")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.telephony")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TelephonyPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
|
|
||||||
void receivePacket(const NetworkPacket &np) override;
|
void receivePacket(const NetworkPacket &np) override;
|
||||||
QString dbusPath() const override;
|
QString dbusPath() const override;
|
||||||
|
|
|
@ -19,11 +19,6 @@
|
||||||
K_PLUGIN_CLASS_WITH_JSON(VirtualMonitorPlugin, "kdeconnect_virtualmonitor.json")
|
K_PLUGIN_CLASS_WITH_JSON(VirtualMonitorPlugin, "kdeconnect_virtualmonitor.json")
|
||||||
#define QS QLatin1String
|
#define QS QLatin1String
|
||||||
|
|
||||||
VirtualMonitorPlugin::VirtualMonitorPlugin(QObject *parent, const QVariantList &args)
|
|
||||||
: KdeConnectPlugin(parent, args)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
VirtualMonitorPlugin::~VirtualMonitorPlugin()
|
VirtualMonitorPlugin::~VirtualMonitorPlugin()
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
|
|
|
@ -21,7 +21,7 @@ class VirtualMonitorPlugin : public KdeConnectPlugin
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.virtualmonitor")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.virtualmonitor")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VirtualMonitorPlugin(QObject *parent, const QVariantList &args);
|
using KdeConnectPlugin::KdeConnectPlugin;
|
||||||
~VirtualMonitorPlugin() override;
|
~VirtualMonitorPlugin() override;
|
||||||
|
|
||||||
Q_SCRIPTABLE bool requestVirtualMonitor();
|
Q_SCRIPTABLE bool requestVirtualMonitor();
|
||||||
|
|
Loading…
Reference in a new issue