Commit 596e4484 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Clean up use of virtual and override keywords

Only use virtual when actually virtual, to override just use override.
parent cc0fdacb
......@@ -40,7 +40,7 @@ public:
enum PairStatus : bool { NotPaired, Paired };
DeviceLink(const QString& deviceId, LinkProvider* parent);
virtual ~DeviceLink() { };
virtual ~DeviceLink() = default;
virtual QString name() = 0;
......
......@@ -38,8 +38,8 @@ class KDECONNECTCORE_EXPORT DownloadJob
Q_OBJECT
public:
DownloadJob(const QHostAddress &address, const QVariantMap &transferInfo);
~DownloadJob();
void start() Q_DECL_OVERRIDE;
~DownloadJob() override;
void start() override;
QSharedPointer<QIODevice> getPayload();
private:
......
......@@ -43,16 +43,16 @@ public:
LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSslSocket* socket, ConnectionStarted connectionSource);
void reset(QSslSocket* socket, ConnectionStarted connectionSource);
virtual QString name() Q_DECL_OVERRIDE;
QString name() override;
bool sendPackage(NetworkPackage& np) override;
UploadJob* sendPayload(NetworkPackage& np);
virtual void userRequestsPair() override;
virtual void userRequestsUnpair() override;
void userRequestsPair() override;
void userRequestsUnpair() override;
virtual void setPairStatus(PairStatus status) override;
void setPairStatus(PairStatus status) override;
virtual bool linkShouldBeKeptAlive() override;
bool linkShouldBeKeptAlive() override;
private Q_SLOTS:
void dataReceived();
......
......@@ -41,7 +41,7 @@ class KDECONNECTCORE_EXPORT LanLinkProvider
public:
LanLinkProvider(bool testMode = false);
~LanLinkProvider();
~LanLinkProvider() override;
QString name() override { return "LanLinkProvider"; }
int priority() override { return PRIORITY_HIGH; }
......@@ -51,9 +51,9 @@ public:
void incomingPairPackage(DeviceLink* device, const NetworkPackage& np);
public Q_SLOTS:
virtual void onNetworkChange() override;
virtual void onStart() override;
virtual void onStop() override;
void onNetworkChange() override;
void onStart() override;
void onStop() override;
void connected();
void encrypted();
void connectError();
......
......@@ -39,13 +39,13 @@ public:
};
LanPairingHandler(DeviceLink* deviceLink);
virtual ~LanPairingHandler() { }
~LanPairingHandler() override { }
virtual void packageReceived(const NetworkPackage& np) Q_DECL_OVERRIDE;
virtual bool requestPairing() Q_DECL_OVERRIDE;
virtual bool acceptPairing() Q_DECL_OVERRIDE;
virtual void rejectPairing() Q_DECL_OVERRIDE;
virtual void unpair() Q_DECL_OVERRIDE;
void packageReceived(const NetworkPackage& np) override;
bool requestPairing() override;
bool acceptPairing() override;
void rejectPairing() override;
void unpair() override;
bool isPairRequested() const { return m_status == Requested; }
bool isPaired() const { return m_status == Paired; }
......
......@@ -38,13 +38,13 @@ private:
public:
Server(QObject* parent = 0);
virtual ~Server() {}
~Server() override = default;
QSslSocket* nextPendingConnection() Q_DECL_OVERRIDE;
bool hasPendingConnections() const Q_DECL_OVERRIDE;
QSslSocket* nextPendingConnection() override;
bool hasPendingConnections() const override;
protected:
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
void incomingConnection(qintptr socketDescriptor) override;
};
#endif //KDECONNECT_SERVER_H
......@@ -36,7 +36,7 @@ class UploadJob
public:
explicit UploadJob(const QSharedPointer<QIODevice>& source, const QString& deviceId);
virtual void start() override;
void start() override;
QVariantMap transferInfo();
......
......@@ -42,7 +42,7 @@ public:
const static int PRIORITY_HIGH = 100; //eg: lan
LinkProvider();
virtual ~LinkProvider() { }
~LinkProvider() override = default;
virtual QString name() = 0;
virtual int priority() = 0;
......
......@@ -32,11 +32,11 @@ class LoopbackDeviceLink
public:
LoopbackDeviceLink(const QString& d, LoopbackLinkProvider* a);
virtual QString name() override;
virtual bool sendPackage(NetworkPackage& np) override;
QString name() override;
bool sendPackage(NetworkPackage& np) override;
virtual void userRequestsPair() override { setPairStatus(Paired); }
virtual void userRequestsUnpair() override { setPairStatus(NotPaired); }
void userRequestsPair() override { setPairStatus(Paired); }
void userRequestsUnpair() override { setPairStatus(NotPaired); }
};
#endif
......@@ -31,14 +31,14 @@ class LoopbackLinkProvider
Q_OBJECT
public:
LoopbackLinkProvider();
~LoopbackLinkProvider();
~LoopbackLinkProvider() override;
QString name() override { return "LoopbackLinkProvider"; }
int priority() override { return PRIORITY_LOW; }
virtual void onStart() override;
virtual void onStop() override;
virtual void onNetworkChange() override;
void onStart() override;
void onStop() override;
void onNetworkChange() override;
private:
QPointer<LoopbackDeviceLink> loopbackDeviceLink;
......
......@@ -43,7 +43,7 @@ class KDECONNECTCORE_EXPORT PairingHandler : public QObject
public:
PairingHandler(DeviceLink* parent);
virtual ~PairingHandler() { }
~PairingHandler() override = default;
DeviceLink* deviceLink() const;
void setDeviceLink(DeviceLink* dl);
......
......@@ -42,7 +42,7 @@ class KDECONNECTCORE_EXPORT Daemon
public:
explicit Daemon(QObject *parent, bool testMode = false);
~Daemon();
~Daemon() override;
/**
* Returns the daemon.
......
......@@ -78,7 +78,7 @@ public:
*/
Device(QObject* parent, const NetworkPackage& np, DeviceLink* dl);
virtual ~Device();
~Device() override;
QString id() const { return m_deviceId; }
QString name() const { return m_deviceName; }
......@@ -113,6 +113,7 @@ public:
public Q_SLOTS:
///sends a @p np package to the device
///virtual for testing purposes.
virtual bool sendPackage(NetworkPackage& np);
//Dbus operations
......
......@@ -53,7 +53,7 @@ public:
* @p destination specifies where these contents should be stored
*/
FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 size, const QUrl &destination);
virtual void start() Q_DECL_OVERRIDE;
void start() override;
QUrl destination() const { return mDestination; }
void setOriginName(QString from) { mFrom = from; }
......@@ -61,7 +61,7 @@ private Q_SLOTS:
void doStart();
protected:
bool doKill() Q_DECL_OVERRIDE;
bool doKill() override;
private:
void startTransfer();
......
......@@ -38,7 +38,7 @@ class KDECONNECTCORE_EXPORT KdeConnectPlugin
public:
KdeConnectPlugin(QObject* parent, const QVariantList& args);
virtual ~KdeConnectPlugin();
~KdeConnectPlugin() override;
const Device* device();
Device const* device() const;
......
......@@ -37,7 +37,7 @@ class KDECONNECTCORE_EXPORT KdeConnectPluginConfig : public QObject
public:
KdeConnectPluginConfig(const QString& deviceId, const QString& pluginName);
~KdeConnectPluginConfig();
~KdeConnectPluginConfig() override;
/**
* A directory to store stuff for this device and plugin. It's private in the sense
......
......@@ -41,7 +41,7 @@ public:
, m_nam(Q_NULLPTR)
{}
void askPairingConfirmation(PairingHandler* d) Q_DECL_OVERRIDE
void askPairingConfirmation(PairingHandler* d) override
{
KNotification* notification = new KNotification("pairingRequest");
notification->setIconName(QStringLiteral("dialog-information"));
......@@ -54,12 +54,12 @@ public:
notification->sendEvent();
}
void reportError(const QString & title, const QString & description) Q_DECL_OVERRIDE
void reportError(const QString & title, const QString & description) override
{
KNotification::event(KNotification::Error, title, description);
}
QNetworkAccessManager* networkAccessManager() Q_DECL_OVERRIDE
QNetworkAccessManager* networkAccessManager() override
{
if (!m_nam) {
m_nam = new KIO::AccessManager(this);
......
......@@ -35,7 +35,7 @@ class SendFileItemAction : public KAbstractFileItemActionPlugin
Q_OBJECT
public:
SendFileItemAction(QObject* parent, const QVariantList &args);
virtual QList< QAction* > actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget) override;
QList< QAction* > actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget) override;
private Q_SLOTS:
void sendFile();
......
......@@ -45,7 +45,7 @@ class KDECONNECTINTERFACES_EXPORT DaemonDbusInterface
Q_OBJECT
public:
explicit DaemonDbusInterface(QObject* parent = nullptr);
virtual ~DaemonDbusInterface();
~DaemonDbusInterface() override;
static QString activatedService();
......@@ -63,7 +63,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceDbusInterface
public:
explicit DeviceDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~DeviceDbusInterface();
~DeviceDbusInterface() override;
Q_SCRIPTABLE QString id() const;
Q_SCRIPTABLE void pluginCall(const QString &plugin, const QString &method);
......@@ -81,7 +81,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceBatteryDbusInterface
Q_OBJECT
public:
explicit DeviceBatteryDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~DeviceBatteryDbusInterface();
~DeviceBatteryDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface
......@@ -90,7 +90,7 @@ class KDECONNECTINTERFACES_EXPORT DeviceNotificationsDbusInterface
Q_OBJECT
public:
explicit DeviceNotificationsDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~DeviceNotificationsDbusInterface();
~DeviceNotificationsDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface
......@@ -99,7 +99,7 @@ class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface
Q_OBJECT
public:
NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent = nullptr);
virtual ~NotificationDbusInterface();
~NotificationDbusInterface() override;
QString notificationId() { return id; }
private:
......@@ -113,7 +113,7 @@ class KDECONNECTINTERFACES_EXPORT SftpDbusInterface
Q_OBJECT
public:
explicit SftpDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~SftpDbusInterface();
~SftpDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT MprisDbusInterface
......@@ -130,7 +130,7 @@ class KDECONNECTINTERFACES_EXPORT MprisDbusInterface
Q_PROPERTY(int position READ position WRITE setPosition NOTIFY propertiesChangedProxy)
public:
explicit MprisDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~MprisDbusInterface();
~MprisDbusInterface() override;
Q_SIGNALS:
void propertiesChangedProxy();
......@@ -152,7 +152,7 @@ class KDECONNECTINTERFACES_EXPORT LockDeviceDbusInterface
Q_PROPERTY(bool isLocked READ isLocked WRITE setIsLocked NOTIFY lockedChangedProxy)
public:
explicit LockDeviceDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~LockDeviceDbusInterface();
~LockDeviceDbusInterface() override;
Q_SIGNALS:
void lockedChangedProxy(bool isLocked);
......@@ -164,7 +164,7 @@ class KDECONNECTINTERFACES_EXPORT FindMyPhoneDeviceDbusInterface
Q_OBJECT
public:
explicit FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent = nullptr);
virtual ~FindMyPhoneDeviceDbusInterface();
~FindMyPhoneDeviceDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT RemoteCommandsDbusInterface
......
......@@ -61,16 +61,16 @@ public:
Q_ENUM(StatusFilterFlag)
explicit DevicesModel(QObject *parent = nullptr);
virtual ~DevicesModel();
~DevicesModel() override;
void setDisplayFilter(int flags);
int displayFilter() const;
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
Q_SCRIPTABLE DeviceDbusInterface* getDevice(int row) const;
virtual QHash<int, QByteArray> roleNames() const override;
QHash<int, QByteArray> roleNames() const override;
private Q_SLOTS:
void deviceAdded(const QString& id);
......
......@@ -31,9 +31,9 @@ class KDECONNECTINTERFACES_EXPORT DevicesSortProxyModel : public QSortFilterProx
Q_OBJECT
public:
explicit DevicesSortProxyModel(DevicesModel* devicesModel = Q_NULLPTR);
virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
virtual void setSourceModel(QAbstractItemModel *sourceModel) override;
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
void setSourceModel(QAbstractItemModel *sourceModel) override;
public Q_SLOTS:
void sourceDataChanged();
......
......@@ -48,18 +48,18 @@ public:
};
explicit NotificationsModel(QObject* parent = nullptr);
virtual ~NotificationsModel();
~NotificationsModel() override;
QString deviceId() const;
void setDeviceId(const QString& deviceId);
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
NotificationDbusInterface* getNotification(const QModelIndex& index) const;
Q_INVOKABLE bool isAnyDimissable() const;
virtual QHash<int, QByteArray> roleNames() const override;
QHash<int, QByteArray> roleNames() const override;
public Q_SLOTS:
void dismissAll();
......
......@@ -40,12 +40,12 @@ class KdeConnectKcm
Q_OBJECT
public:
KdeConnectKcm(QWidget *parent, const QVariantList&);
virtual ~KdeConnectKcm();
~KdeConnectKcm() override;
private:
virtual void save();
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
void save() override;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
private Q_SLOTS:
void deviceSelected(const QModelIndex& current);
......
......@@ -39,7 +39,7 @@ class KDECONNECTPLUGINKCM_EXPORT KdeConnectPluginKcm
public:
KdeConnectPluginKcm(QWidget* parent, const QVariantList& args, const QString& componentName);
virtual ~KdeConnectPluginKcm();
~KdeConnectPluginKcm() override;
/**
* The device this kcm is instantiated for
......
......@@ -29,8 +29,8 @@ class KdeConnectDeclarativePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
virtual void registerTypes(const char* uri) override;
virtual void initializeEngine(QQmlEngine *engine, const char *uri) override;
void registerTypes(const char* uri) override;
void initializeEngine(QQmlEngine *engine, const char *uri) override;
};
#endif // KDECONNECTDECLARATIVEPLUGIN_H
......@@ -19,7 +19,7 @@ public:
ObjectFactory(QObject* parent, Func1 f1) : QObject(parent), m_f0(nullptr), m_f1(f1), m_f2(nullptr) {}
ObjectFactory(QObject* parent, Func2 f2) : QObject(parent), m_f0(nullptr), m_f1(nullptr), m_f2(f2) {}
virtual ~ObjectFactory() {}
~ObjectFactory() override = default;
Q_INVOKABLE QObject* create() {
if (m_f0) return m_f0();
......
......@@ -28,7 +28,7 @@ class ProcessRunner : public QObject
public:
explicit ProcessRunner(QObject *parent = nullptr);
~ProcessRunner();
~ProcessRunner() override;
Q_INVOKABLE void runKdeconnectKCM();
};
......
......@@ -37,7 +37,7 @@ class DBusAsyncResponse : public QObject
public:
explicit DBusAsyncResponse(QObject* parent = nullptr);
virtual ~DBusAsyncResponse() {};
~DBusAsyncResponse() override = default;
Q_INVOKABLE void setPendingCall(QVariant e);
......
......@@ -33,7 +33,7 @@ class BatteryDbusInterface
public:
explicit BatteryDbusInterface(const Device *device);
virtual ~BatteryDbusInterface();
~BatteryDbusInterface() override;
Q_SCRIPTABLE int charge() const { return mCharge; }
Q_SCRIPTABLE bool isCharging() const { return mIsCharging; }
......
......@@ -36,11 +36,11 @@ class BatteryPlugin
public:
explicit BatteryPlugin(QObject *parent, const QVariantList &args);
virtual ~BatteryPlugin();
~BatteryPlugin() override;
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override;
bool receivePackage(const NetworkPackage& np) override;
void connected() override;
private:
// Keep these values in sync with THRESHOLD* constants in
......
......@@ -38,8 +38,8 @@ public:
explicit ClipboardPlugin(QObject *parent, const QVariantList &args);
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override { }
bool receivePackage(const NetworkPackage& np) override;
void connected() override { }
private Q_SLOTS:
void clipboardChanged(QClipboard::Mode mode);
......
......@@ -35,13 +35,13 @@ class FindMyPhonePlugin
public:
explicit FindMyPhonePlugin(QObject *parent, const QVariantList &args);
virtual ~FindMyPhonePlugin();
~FindMyPhonePlugin() override;
Q_SCRIPTABLE void ring();
public Q_SLOTS:
virtual void connected();
virtual bool receivePackage(const NetworkPackage& np);
void connected() override;
bool receivePackage(const NetworkPackage& np) override;
private:
QString dbusPath() const;
......
......@@ -39,7 +39,7 @@ class Q_DECL_EXPORT LockDevicePlugin
public:
explicit LockDevicePlugin(QObject *parent, const QVariantList &args);
virtual ~LockDevicePlugin();
~LockDevicePlugin() override;
bool isLocked() const;
void setLocked(bool b);
......
......@@ -44,10 +44,10 @@ class MousepadPlugin
public:
explicit MousepadPlugin(QObject *parent, const QVariantList &args);
virtual ~MousepadPlugin();
~MousepadPlugin() override;
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override { }
bool receivePackage(const NetworkPackage& np) override;
void connected() override { }
private:
#if HAVE_X11
......
......@@ -41,8 +41,8 @@ public:
explicit MprisControlPlugin(QObject *parent, const QVariantList &args);
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override { }
bool receivePackage(const NetworkPackage& np) override;
void connected() override { }
private Q_SLOTS:
void propertiesChanged(const QString& propertyInterface, const QVariantMap& properties);
......
......@@ -43,7 +43,7 @@ class Q_DECL_EXPORT MprisRemotePlugin
public:
explicit MprisRemotePlugin(QObject *parent, const QVariantList &args);
virtual ~MprisRemotePlugin();
~MprisRemotePlugin() override;
long position() const;
int volume() const { return m_volume; }
......@@ -58,8 +58,8 @@ public:
void setPlayer(const QString& player);
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np);
virtual void connected();
bool receivePackage(const NetworkPackage& np) override;
void connected() override;
void seek(int offset) const;
void requestPlayerStatus();
......
......@@ -39,7 +39,7 @@ class Notification
public:
Notification(const NetworkPackage& np, const QString& iconPath, QObject* parent);
virtual ~Notification();
~Notification() override;
QString internalId() const { return mInternalId; }
QString appName() const { return mAppName; }
......
......@@ -40,7 +40,7 @@ class NotificationsDbusInterface
public:
explicit NotificationsDbusInterface(KdeConnectPlugin* plugin);
virtual ~NotificationsDbusInterface();
~NotificationsDbusInterface() override;
void processPackage(const NetworkPackage& np);
void clearNotifications();
......
......@@ -42,11 +42,11 @@ class NotificationsPlugin
public:
explicit NotificationsPlugin(QObject *parent, const QVariantList &args);
virtual ~NotificationsPlugin();
~NotificationsPlugin() override;
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override;
bool receivePackage(const NetworkPackage& np) override;
void connected() override;
protected:
NotificationsDbusInterface* notificationsDbusInterface;
......
......@@ -33,12 +33,12 @@ class PauseMusicConfig
Q_OBJECT
public:
PauseMusicConfig(QWidget *parent, const QVariantList&);
virtual ~PauseMusicConfig();
~PauseMusicConfig() override;
public Q_SLOTS:
virtual void save() override;
virtual void load() override;
virtual void defaults() override;
void save() override;
void load() override;
void defaults() override;
private:
Ui::PauseMusicConfigUi* m_ui;
......
......@@ -36,8 +36,8 @@ public:
explicit PauseMusicPlugin(QObject *parent, const QVariantList &args);
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override { }
bool receivePackage(const NetworkPackage& np) override;
void connected() override { }
/**
* @returns 0 if not muted, 1 if muted or -1 if there was an error
......
......@@ -35,14 +35,14 @@ class Q_DECL_EXPORT PingPlugin
public:
explicit PingPlugin(QObject *parent, const QVariantList &args);
virtual ~PingPlugin();
~PingPlugin() override;
Q_SCRIPTABLE void sendPing();
Q_SCRIPTABLE void sendPing(const QString& customMessage);
public Q_SLOTS:
virtual bool receivePackage(const NetworkPackage& np) override;
virtual void connected() override;
bool receivePackage(const NetworkPackage& np) override;
void connected() override;
private:
QString dbusPath() const;
......
......@@ -31,12 +31,12 @@ class RunCommandConfig
Q_OBJECT
public:
RunCommandConfig(QWidget *parent, const QVariantList&);
virtual ~RunCommandConfig();
~RunCommandConfig() override;
public Q_SLOTS:
virtual void save() Q_DECL_OVERRIDE;
virtual void load() Q_DECL_OVERRIDE;
virtual void defaults() Q_DECL_OVERRIDE;
void save() override;
void load() override;
void defaults() override;
private Q_SLOTS:
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
......
......@@ -37,12 +37,12 @@ class Q_DECL_EXPORT RunCommandPlugin