Use override

This commit is contained in:
Jonas Kvinge 2020-06-26 23:01:57 +02:00
parent f1115ba706
commit b51cc21140
17 changed files with 66 additions and 66 deletions

View File

@ -92,7 +92,7 @@ public:
* @see See the corresponding QAPPLICATION_CLASS constructor for reference * @see See the corresponding QAPPLICATION_CLASS constructor for reference
*/ */
explicit SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000 ); explicit SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000 );
~SingleApplication(); ~SingleApplication() override;
/** /**
* @brief Returns if the instance is the primary instance * @brief Returns if the instance is the primary instance

View File

@ -75,7 +75,7 @@ class SingleApplicationPrivate : public QObject {
Q_DECLARE_PUBLIC(SingleApplication) Q_DECLARE_PUBLIC(SingleApplication)
explicit SingleApplicationPrivate(SingleApplication *_q_ptr); explicit SingleApplicationPrivate(SingleApplication *_q_ptr);
~SingleApplicationPrivate(); ~SingleApplicationPrivate() override;
void genBlockServerName(); void genBlockServerName();
void initializeMemoryBlock(); void initializeMemoryBlock();

View File

@ -92,7 +92,7 @@ public:
* @see See the corresponding QAPPLICATION_CLASS constructor for reference * @see See the corresponding QAPPLICATION_CLASS constructor for reference
*/ */
explicit SingleCoreApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000 ); explicit SingleCoreApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000 );
~SingleCoreApplication(); ~SingleCoreApplication() override;
/** /**
* @brief Returns if the instance is the primary instance * @brief Returns if the instance is the primary instance

View File

@ -75,7 +75,7 @@ class SingleCoreApplicationPrivate : public QObject {
Q_DECLARE_PUBLIC(SingleCoreApplication) Q_DECLARE_PUBLIC(SingleCoreApplication)
explicit SingleCoreApplicationPrivate(SingleCoreApplication *_q_ptr); explicit SingleCoreApplicationPrivate(SingleCoreApplication *_q_ptr);
~SingleCoreApplicationPrivate(); ~SingleCoreApplicationPrivate() override;
void genBlockServerName(); void genBlockServerName();
void initializeMemoryBlock(); void initializeMemoryBlock();

View File

@ -65,7 +65,7 @@ class ObjectHelper : public QObject {
Q_OBJECT Q_OBJECT
public: public:
ObjectHelper(QObject *sender, const char *signal, ClosureBase *closure); ObjectHelper(QObject *sender, const char *signal, ClosureBase *closure);
~ObjectHelper(); ~ObjectHelper() override;
private slots: private slots:
void Invoked(); void Invoked();
@ -113,7 +113,7 @@ class Closure : public ClosureBase {
QObject::connect(receiver_, SIGNAL(destroyed()), helper_, SLOT(deleteLater())); QObject::connect(receiver_, SIGNAL(destroyed()), helper_, SLOT(deleteLater()));
} }
virtual void Invoke() { void Invoke() override {
function_(); function_();
} }
@ -167,7 +167,7 @@ class CallbackClosure : public ClosureBase {
public: public:
CallbackClosure(QObject *sender, const char *signal, std::function<void()> callback); CallbackClosure(QObject *sender, const char *signal, std::function<void()> callback);
virtual void Invoke(); void Invoke() override;
private: private:
std::function<void()> callback_; std::function<void()> callback_;

View File

@ -59,7 +59,7 @@ class ThreadFunctorBase : public QFutureInterface<ReturnType>, public QRunnable
return future; return future;
} }
virtual void run() = 0; void run() override = 0;
}; };
template <typename ReturnType, typename... Args> template <typename ReturnType, typename... Args>
@ -69,7 +69,7 @@ class ThreadFunctor : public ThreadFunctorBase<ReturnType> {
: function_(std::bind(function, args...)) { : function_(std::bind(function, args...)) {
} }
virtual void run() { void run() override {
this->reportResult(function_()); this->reportResult(function_());
this->reportFinished(); this->reportFinished();
} }
@ -86,7 +86,7 @@ class ThreadFunctor <void, Args...> : public ThreadFunctorBase<void> {
: function_(std::bind(function, args...)) { : function_(std::bind(function, args...)) {
} }
virtual void run() { void run() override {
function_(); function_();
this->reportFinished(); this->reportFinished();
} }

View File

@ -41,8 +41,8 @@ namespace logging {
class NullDevice : public QIODevice { class NullDevice : public QIODevice {
protected: protected:
qint64 readData(char*, qint64) { return -1; } qint64 readData(char*, qint64) override { return -1; }
qint64 writeData(const char*, qint64 len) { return len; } qint64 writeData(const char*, qint64 len) override { return len; }
}; };
enum Level { enum Level {

View File

@ -82,7 +82,7 @@ template <typename MT>
class AbstractMessageHandler : public _MessageHandlerBase { class AbstractMessageHandler : public _MessageHandlerBase {
public: public:
AbstractMessageHandler(QIODevice *device, QObject *parent); AbstractMessageHandler(QIODevice *device, QObject *parent);
~AbstractMessageHandler() { AbortAll(); } ~AbstractMessageHandler() override { AbortAll(); }
typedef MT MessageType; typedef MT MessageType;
typedef MessageReply<MT> ReplyType; typedef MessageReply<MT> ReplyType;
@ -107,8 +107,8 @@ protected:
virtual void MessageArrived(const MessageType &message) { Q_UNUSED(message); } virtual void MessageArrived(const MessageType &message) { Q_UNUSED(message); }
// _MessageHandlerBase // _MessageHandlerBase
bool RawMessageArrived(const QByteArray &data); bool RawMessageArrived(const QByteArray &data) override;
void AbortAll(); void AbortAll() override;
private: private:
QMap<int, ReplyType*> pending_replies_; QMap<int, ReplyType*> pending_replies_;

View File

@ -59,7 +59,7 @@ class MessageReply : public _MessageReplyBase {
public: public:
explicit MessageReply(const MessageType& request_message, QObject *parent = nullptr); explicit MessageReply(const MessageType& request_message, QObject *parent = nullptr);
int id() const { return request_message_.id(); } int id() const override { return request_message_.id(); }
const MessageType& request_message() const { return request_message_; } const MessageType& request_message() const { return request_message_; }
const MessageType& message() const { return reply_message_; } const MessageType& message() const { return reply_message_; }

View File

@ -68,7 +68,7 @@ template <typename HandlerType>
class WorkerPool : public _WorkerPoolBase { class WorkerPool : public _WorkerPoolBase {
public: public:
explicit WorkerPool(QObject *parent = nullptr); explicit WorkerPool(QObject *parent = nullptr);
~WorkerPool(); ~WorkerPool() override;
typedef typename HandlerType::MessageType MessageType; typedef typename HandlerType::MessageType MessageType;
typedef typename HandlerType::ReplyType ReplyType; typedef typename HandlerType::ReplyType ReplyType;
@ -95,10 +95,10 @@ class WorkerPool : public _WorkerPoolBase {
protected: protected:
// These are all reimplemented slots, they are called on the WorkerPool's thread. // These are all reimplemented slots, they are called on the WorkerPool's thread.
void DoStart(); void DoStart() override;
void NewConnection(); void NewConnection() override;
void ProcessError(QProcess::ProcessError error); void ProcessError(QProcess::ProcessError error) override;
void SendQueuedMessages(); void SendQueuedMessages() override;
private: private:
struct Worker { struct Worker {

View File

@ -33,8 +33,8 @@ public:
explicit TagReaderWorker(QIODevice *socket, QObject *parent = nullptr); explicit TagReaderWorker(QIODevice *socket, QObject *parent = nullptr);
protected: protected:
void MessageArrived(const pb::tagreader::Message &message); void MessageArrived(const pb::tagreader::Message &message) override;
void DeviceClosed(); void DeviceClosed() override;
private: private:
TagReader tag_reader_; TagReader tag_reader_;

View File

@ -44,20 +44,20 @@ class AfcDevice : public GPodDevice {
public: public:
Q_INVOKABLE AfcDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time); Q_INVOKABLE AfcDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time);
~AfcDevice(); ~AfcDevice() override;
bool Init(); bool Init() override;
static QStringList url_schemes() { return QStringList() << "afc"; } static QStringList url_schemes() { return QStringList() << "afc"; }
bool StartCopy(QList<Song::FileType> *supported_types); bool StartCopy(QList<Song::FileType> *supported_types) override;
bool CopyToStorage(const CopyJob &job); bool CopyToStorage(const CopyJob &job) override;
void FinishCopy(const bool success); void FinishCopy(const bool success) override;
bool DeleteFromStorage(const DeleteJob &job); bool DeleteFromStorage(const DeleteJob &job) override;
protected: protected:
void FinaliseDatabase(); void FinaliseDatabase() override;
private slots: private slots:
void CopyFinished(bool success); void CopyFinished(bool success);

View File

@ -18,18 +18,18 @@ class AfcFile : public QIODevice {
public: public:
explicit AfcFile(iMobileDeviceConnection* connection, const QString &path, QObject *parent = nullptr); explicit AfcFile(iMobileDeviceConnection* connection, const QString &path, QObject *parent = nullptr);
~AfcFile(); ~AfcFile() override;
// QIODevice // QIODevice
void close(); void close() override;
bool open(OpenMode mode); bool open(OpenMode mode) override;
bool seek(qint64 pos); bool seek(qint64 pos) override;
qint64 size() const; qint64 size() const override;
private: private:
// QIODevice // QIODevice
qint64 readData(char *data, qint64 max_size); qint64 readData(char *data, qint64 max_size) override;
qint64 writeData(const char *data, qint64 max_size); qint64 writeData(const char *data, qint64 max_size) override;
iMobileDeviceConnection *connection_; iMobileDeviceConnection *connection_;
uint64_t handle_; uint64_t handle_;

View File

@ -48,25 +48,25 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage {
public: public:
Q_INVOKABLE GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time); Q_INVOKABLE GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time);
~GPodDevice(); ~GPodDevice() override;
bool Init(); bool Init() override;
void ConnectAsync(); void ConnectAsync() override;
void Close(); void Close() override;
bool IsLoading() { return loader_; } bool IsLoading() override { return loader_; }
QObject *Loader() { return loader_; } QObject *Loader() { return loader_; }
static QStringList url_schemes() { return QStringList() << "ipod"; } static QStringList url_schemes() { return QStringList() << "ipod"; }
bool GetSupportedFiletypes(QList<Song::FileType> *ret); bool GetSupportedFiletypes(QList<Song::FileType> *ret) override;
bool StartCopy(QList<Song::FileType> *supported_types); bool StartCopy(QList<Song::FileType> *supported_types) override;
bool CopyToStorage(const CopyJob &job); bool CopyToStorage(const CopyJob &job) override;
void FinishCopy(bool success); void FinishCopy(bool success) override;
void StartDelete(); void StartDelete() override;
bool DeleteFromStorage(const DeleteJob &job); bool DeleteFromStorage(const DeleteJob &job) override;
void FinishDelete(bool success); void FinishDelete(bool success) override;
protected slots: protected slots:
void LoadFinished(Itdb_iTunesDB *db, bool success); void LoadFinished(Itdb_iTunesDB *db, bool success);

View File

@ -41,7 +41,7 @@ class GPodLoader : public QObject {
public: public:
explicit GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device); explicit GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device);
~GPodLoader(); ~GPodLoader() override;
void set_music_path_prefix(const QString &prefix) { path_prefix_ = prefix; } void set_music_path_prefix(const QString &prefix) { path_prefix_ = prefix; }
void set_song_type(Song::FileType type) { type_ = type; } void set_song_type(Song::FileType type) { type_ = type; }

View File

@ -40,22 +40,22 @@ class iLister : public DeviceLister {
public: public:
explicit iLister(); explicit iLister();
~iLister(); ~iLister() override;
int priority() const { return 120; } int priority() const override { return 120; }
virtual QStringList DeviceUniqueIDs(); QStringList DeviceUniqueIDs() override;
virtual QVariantList DeviceIcons(const QString &id); QVariantList DeviceIcons(const QString &id) override;
virtual QString DeviceManufacturer(const QString &id); QString DeviceManufacturer(const QString &id) override;
virtual QString DeviceModel(const QString &id); QString DeviceModel(const QString &id) override;
virtual quint64 DeviceCapacity(const QString &id); quint64 DeviceCapacity(const QString &id) override;
virtual quint64 DeviceFreeSpace(const QString &id); quint64 DeviceFreeSpace(const QString &id) override;
virtual QVariantMap DeviceHardwareInfo(const QString &id); QVariantMap DeviceHardwareInfo(const QString &id) override;
virtual QString MakeFriendlyName(const QString &id); QString MakeFriendlyName(const QString &id) override;
virtual QList<QUrl> MakeDeviceUrls(const QString &id); QList<QUrl> MakeDeviceUrls(const QString &id) override;
public slots: public slots:
virtual void UpdateDeviceFreeSpace(const QString &id); void UpdateDeviceFreeSpace(const QString &id) override;
private: private:
struct DeviceInfo { struct DeviceInfo {
@ -80,7 +80,7 @@ class iLister : public DeviceLister {
QString bt_mac; QString bt_mac;
}; };
virtual bool Init(); bool Init() override;
static void EventCallback(const idevice_event_t *event, void *context); static void EventCallback(const idevice_event_t *event, void *context);

View File

@ -34,10 +34,10 @@
class PulseDeviceFinder : public DeviceFinder { class PulseDeviceFinder : public DeviceFinder {
public: public:
explicit PulseDeviceFinder(); explicit PulseDeviceFinder();
~PulseDeviceFinder(); ~PulseDeviceFinder() override;
virtual bool Initialise(); bool Initialise() override;
virtual QList<Device> ListDevices(); QList<Device> ListDevices() override;
private: private:
struct ListDevicesState { struct ListDevicesState {