From 1fae365605a136e6cc619a159fa377d57fe35e96 Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 18 Nov 2024 00:46:26 +0000 Subject: [PATCH] cleanup: Use `= default` instead of `{}` for default ctors. Also remove redundant `virtual` when functions are already marked as `override`. Also use `nullptr` more. ```sh run-clang-tidy -p _build -fix \ $(find . -name "*.h" -or -name "*.cpp" -or -name "*.c" | grep -v "/_build/") \ -checks="-*,modernize-use-equals-*,modernize-use-nullptr,modernize-use-override" ``` --- .ci-scripts/build-qtox-linux.sh | 2 +- .clang-tidy | 3 ++ .github/workflows/build-test-deploy.yaml | 2 +- audio/include/audio/iaudiocontrol.h | 2 +- audio/include/audio/iaudiosource.h | 2 +- audio/src/backend/alsink.h | 2 +- audio/src/backend/alsource.h | 4 +- audio/src/backend/openal.h | 38 +++++++++--------- src/appmanager.h | 2 +- src/chatlog/chatline.cpp | 2 +- src/chatlog/chatline.h | 2 +- src/chatlog/chatlinecontent.h | 4 +- src/chatlog/chatmessage.h | 2 +- src/chatlog/chatwidget.h | 2 +- src/chatlog/content/filetransferwidget.h | 2 +- src/chatlog/content/text.h | 2 +- src/chatlog/content/timestamp.h | 2 +- src/chatlog/customtextdocument.h | 2 +- src/chatlog/pixmapcache.h | 5 ++- src/core/core.h | 4 +- src/core/coreav.h | 2 +- src/core/toxcall.h | 8 ++-- src/ipc.h | 2 +- src/model/chat.cpp | 2 +- src/model/chat.h | 2 +- src/model/debug/debugobjecttreemodel.cpp | 2 +- src/model/ichatlog.h | 2 +- src/model/imessagedispatcher.h | 2 +- src/model/notificationgenerator.h | 2 +- src/model/sessionchatlog.h | 2 +- src/nexus.h | 2 +- src/persistence/db/rawdatabase.h | 2 +- src/persistence/db/upgrades/dbupgrader.cpp | 2 +- src/persistence/history.h | 2 +- src/persistence/profile.h | 2 +- src/persistence/profilelocker.h | 3 +- src/persistence/settings.h | 2 +- .../desktop_notifications/desktopnotify.h | 2 +- .../desktopnotifybackend.h | 2 +- src/platform/posixsignalnotifier.h | 2 +- src/video/camerasource.h | 2 +- src/video/netcamview.h | 8 ++-- src/video/videosource.h | 2 +- src/video/videosurface.h | 2 +- src/widget/about/aboutfriendform.h | 2 +- src/widget/chatformheader.h | 2 +- src/widget/circlewidget.h | 2 +- src/widget/conferencewidget.h | 2 +- src/widget/contentdialogmanager.h | 4 +- src/widget/contentlayout.h | 2 +- src/widget/flowlayout.h | 2 +- src/widget/form/addfriendform.h | 2 +- src/widget/form/conferenceform.h | 2 +- src/widget/form/conferenceinviteform.h | 2 +- src/widget/form/debug/debuglog.h | 2 +- src/widget/form/debug/debugobjecttree.cpp | 2 +- src/widget/form/debug/debugobjecttree.h | 2 +- src/widget/form/debugwidget.h | 2 +- src/widget/form/filesform.h | 2 +- src/widget/form/filetransferlist.h | 4 +- src/widget/form/loadhistorydialog.h | 2 +- src/widget/form/profileform.h | 4 +- src/widget/form/searchsettingsform.h | 2 +- src/widget/form/setpassworddialog.h | 2 +- src/widget/form/settings/aboutform.h | 2 +- src/widget/form/settings/advancedform.h | 2 +- src/widget/form/settings/generalform.h | 2 +- src/widget/form/settings/genericsettings.h | 2 +- src/widget/form/settings/privacyform.h | 2 +- src/widget/form/settings/userinterfaceform.h | 2 +- src/widget/form/settingswidget.h | 2 +- src/widget/friendlistwidget.h | 2 +- src/widget/imagepreviewwidget.h | 2 +- src/widget/loginscreen.h | 2 +- src/widget/passwordedit.h | 10 ++--- src/widget/qrwidget.h | 2 +- src/widget/tool/adjustingscrollarea.h | 2 +- src/widget/tool/chattextedit.h | 2 +- src/widget/tool/flyoutoverlaywidget.cpp | 2 +- src/widget/tool/flyoutoverlaywidget.h | 2 +- src/widget/tool/movablewidget.h | 8 ++-- .../tool/screengrabberchooserrectitem.cpp | 2 +- .../tool/screengrabberchooserrectitem.h | 2 +- src/widget/tool/screengrabberoverlayitem.cpp | 2 +- src/widget/tool/screengrabberoverlayitem.h | 2 +- src/widget/tool/toolboxgraphicsitem.cpp | 2 +- src/widget/tool/toolboxgraphicsitem.h | 2 +- src/widget/widget.cpp | 2 +- test/mock/include/mock/mockconferencequery.h | 4 +- test/mock/include/mock/mockcoreidhandler.h | 2 +- test/mock/include/mock/mockcoresettings.h | 2 +- .../conferencemessagedispatcher_test.cpp | 2 +- test/model/friendlistmanager_test.cpp | 4 +- test/model/friendmessagedispatcher_test.cpp | 2 +- test/model/messageprocessor_test.cpp | 2 +- test/model/notificationgenerator_test.cpp | 40 +++++++++---------- test/model/sessionchatlog_test.cpp | 2 +- test/persistence/offlinemsgengine_test.cpp | 4 -- util/include/util/strongtype.h | 2 +- 99 files changed, 159 insertions(+), 162 deletions(-) diff --git a/.ci-scripts/build-qtox-linux.sh b/.ci-scripts/build-qtox-linux.sh index 6b7e869baa..e795f802d8 100755 --- a/.ci-scripts/build-qtox-linux.sh +++ b/.ci-scripts/build-qtox-linux.sh @@ -115,7 +115,7 @@ fi cmake --build "$BUILD_DIR" if [ ! -z "${TIDY+x}" ]; then - run-clang-tidy -p "$BUILD_DIR" -header-filter=.* src/ audio/src/ audio/include test/src/ \ + run-clang-tidy -quiet -fix -format -p "$BUILD_DIR" -header-filter=.* src/ audio/src/ audio/include test/src/ \ test/include util/src/ util/include/ else ctest -j"$(nproc)" --test-dir "$BUILD_DIR" --output-on-failure diff --git a/.clang-tidy b/.clang-tidy index 64f4678149..b80c167e81 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,9 @@ Checks: "-* , modernize-use-bool-literals , modernize-use-emplace +, modernize-use-equals-* +, modernize-use-nullptr +, modernize-use-override , readability-named-parameter , readability-inconsistent-declaration-parameter-name " diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index b85dfa6666..a3da6b7f50 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -131,7 +131,7 @@ jobs: path: ".cache/ccache" key: ${{ github.job }}-ccache - name: Run build - run: docker compose run --rm fedora .ci-scripts/build-qtox-linux.sh --build-type Release --full --tidy + run: docker compose run --rm fedora .ci-scripts/build-qtox-linux.sh --build-type Release --full --tidy || (git diff --exit-code && false) ################################################################################################ # Build and test jobs (PR) diff --git a/audio/include/audio/iaudiocontrol.h b/audio/include/audio/iaudiocontrol.h index 6e19710cc0..737da8420f 100644 --- a/audio/include/audio/iaudiocontrol.h +++ b/audio/include/audio/iaudiocontrol.h @@ -87,7 +87,7 @@ class IAudioControl : public QObject Q_OBJECT public: - virtual ~IAudioControl() = default; + ~IAudioControl() override = default; virtual void setOutputVolume(qreal volume) = 0; virtual qreal maxOutputVolume() const = 0; virtual qreal minOutputVolume() const = 0; diff --git a/audio/include/audio/iaudiosource.h b/audio/include/audio/iaudiosource.h index 23d2ec33ac..ad1a0a88c8 100644 --- a/audio/include/audio/iaudiosource.h +++ b/audio/include/audio/iaudiosource.h @@ -19,7 +19,7 @@ class IAudioSource : public QObject { Q_OBJECT public: - virtual ~IAudioSource() = default; + ~IAudioSource() override = default; virtual operator bool() const = 0; diff --git a/audio/src/backend/alsink.h b/audio/src/backend/alsink.h index f4e4b7dac1..da1d50a9ff 100644 --- a/audio/src/backend/alsink.h +++ b/audio/src/backend/alsink.h @@ -22,7 +22,7 @@ class AlSink : public QObject, public IAudioSink AlSink& operator=(const AlSink&) = delete; AlSink(AlSink&& other) = delete; AlSink& operator=(AlSink&& other) = delete; - ~AlSink(); + ~AlSink() override; void playAudioBuffer(const int16_t* data, int samples, unsigned channels, int sampleRate) const override; diff --git a/audio/src/backend/alsource.h b/audio/src/backend/alsource.h index 41d4979e66..e73a29d068 100644 --- a/audio/src/backend/alsource.h +++ b/audio/src/backend/alsource.h @@ -19,9 +19,9 @@ class AlSource : public IAudioSource AlSource& operator=(const AlSource&) = delete; AlSource(AlSource&& other) = delete; AlSource& operator=(AlSource&& other) = delete; - ~AlSource(); + ~AlSource() override; - operator bool() const; + operator bool() const override; void kill(); diff --git a/audio/src/backend/openal.h b/audio/src/backend/openal.h index 594f31f4a4..d303ff568e 100644 --- a/audio/src/backend/openal.h +++ b/audio/src/backend/openal.h @@ -38,42 +38,42 @@ class OpenAL : public IAudioControl public: explicit OpenAL(IAudioSettings& _settings); - virtual ~OpenAL(); + ~OpenAL() override; - qreal maxOutputVolume() const + qreal maxOutputVolume() const override { return 1; } - qreal minOutputVolume() const + qreal minOutputVolume() const override { return 0; } - void setOutputVolume(qreal volume); + void setOutputVolume(qreal volume) override; - qreal minInputGain() const; - qreal maxInputGain() const; + qreal minInputGain() const override; + qreal maxInputGain() const override; - qreal inputGain() const; - void setInputGain(qreal dB); + qreal inputGain() const override; + void setInputGain(qreal dB) override; - qreal minInputThreshold() const; - qreal maxInputThreshold() const; + qreal minInputThreshold() const override; + qreal maxInputThreshold() const override; - qreal getInputThreshold() const; - void setInputThreshold(qreal normalizedThreshold); + qreal getInputThreshold() const override; + void setInputThreshold(qreal normalizedThreshold) override; - void reinitInput(const QString& inDevDesc); - bool reinitOutput(const QString& outDevDesc); + void reinitInput(const QString& inDevDesc) override; + bool reinitOutput(const QString& outDevDesc) override; - bool isOutputReady() const; + bool isOutputReady() const override; - QStringList outDeviceNames(); - QStringList inDeviceNames(); + QStringList outDeviceNames() override; + QStringList inDeviceNames() override; - std::unique_ptr makeSink(); + std::unique_ptr makeSink() override; void destroySink(AlSink& sink); - std::unique_ptr makeSource(); + std::unique_ptr makeSource() override; void destroySource(AlSource& source); void startLoop(uint sourceId); diff --git a/src/appmanager.h b/src/appmanager.h index 1f662de9b8..efd000f138 100644 --- a/src/appmanager.h +++ b/src/appmanager.h @@ -24,7 +24,7 @@ class AppManager : public QObject public: AppManager(int& argc, char** argv); - ~AppManager(); + ~AppManager() override; int run(); private: diff --git a/src/chatlog/chatline.cpp b/src/chatlog/chatline.cpp index 607d424bcc..7ec9b4dccf 100644 --- a/src/chatlog/chatline.cpp +++ b/src/chatlog/chatline.cpp @@ -9,7 +9,7 @@ #include #include -ChatLine::ChatLine() {} +ChatLine::ChatLine() = default; ChatLine::~ChatLine() { diff --git a/src/chatlog/chatline.h b/src/chatlog/chatline.h index 1994133854..934bdd241d 100644 --- a/src/chatlog/chatline.h +++ b/src/chatlog/chatline.h @@ -31,7 +31,7 @@ struct ColumnFormat Right, }; - ColumnFormat() {} + ColumnFormat() = default; ColumnFormat(qreal s, Policy p, Align hAlign_ = Left) : size(s) , policy(p) diff --git a/src/chatlog/chatlinecontent.h b/src/chatlog/chatlinecontent.h index 8d30709593..e45abfd201 100644 --- a/src/chatlog/chatlinecontent.h +++ b/src/chatlog/chatlinecontent.h @@ -39,8 +39,8 @@ class ChatLineContent : public QObject, public QGraphicsItem virtual qreal getAscent() const; - virtual QRectF boundingRect() const = 0; - virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) = 0; + QRectF boundingRect() const override = 0; + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override = 0; virtual void visibilityChanged(bool visible); virtual void reloadTheme(); diff --git a/src/chatlog/chatmessage.h b/src/chatlog/chatmessage.h index 16d9925399..c695c38476 100644 --- a/src/chatlog/chatmessage.h +++ b/src/chatlog/chatmessage.h @@ -39,7 +39,7 @@ class ChatMessage : public ChatLine }; ChatMessage(DocumentCache& documentCache, Settings& settings, Style& style); - ~ChatMessage(); + ~ChatMessage() override; ChatMessage(const ChatMessage&) = default; ChatMessage(ChatMessage&&) = default; diff --git a/src/chatlog/chatwidget.h b/src/chatlog/chatwidget.h index 053d67b569..2e81157e04 100644 --- a/src/chatlog/chatwidget.h +++ b/src/chatlog/chatwidget.h @@ -33,7 +33,7 @@ class ChatWidget : public QGraphicsView ChatWidget(IChatLog& chatLog_, const Core& core_, DocumentCache& documentCache, SmileyPack& smileyPack, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager, QWidget* parent = nullptr); - virtual ~ChatWidget(); + ~ChatWidget() override; void insertChatlines(std::map chatLines); void clearSelection(); diff --git a/src/chatlog/content/filetransferwidget.h b/src/chatlog/content/filetransferwidget.h index d13024903b..0c5f5e3a18 100644 --- a/src/chatlog/content/filetransferwidget.h +++ b/src/chatlog/content/filetransferwidget.h @@ -30,7 +30,7 @@ class FileTransferWidget : public QWidget public: FileTransferWidget(QWidget* parent, CoreFile& _coreFile, ToxFile file, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager); - virtual ~FileTransferWidget(); + ~FileTransferWidget() override; bool isActive() const; void onFileTransferUpdate(ToxFile file); diff --git a/src/chatlog/content/text.h b/src/chatlog/content/text.h index 41552a1d13..9366541f5d 100644 --- a/src/chatlog/content/text.h +++ b/src/chatlog/content/text.h @@ -32,7 +32,7 @@ class Text : public ChatLineContent Text(DocumentCache& documentCache, Settings& settings, Style& style, const QString& txt = "", const QFont& font = QFont(), bool enableElide = false, const QString& rawText = QString(), const TextType& type = NORMAL); - virtual ~Text(); + ~Text() override; void setText(const QString& txt); void selectText(const QString& txt, const std::pair& point); diff --git a/src/chatlog/content/timestamp.h b/src/chatlog/content/timestamp.h index fb6c47577d..7eb44ad84b 100644 --- a/src/chatlog/content/timestamp.h +++ b/src/chatlog/content/timestamp.h @@ -23,7 +23,7 @@ class Timestamp : public Text QDateTime getTime(); protected: - QSizeF idealSize(); + QSizeF idealSize() override; private: QDateTime time; diff --git a/src/chatlog/customtextdocument.h b/src/chatlog/customtextdocument.h index 6d3b459a56..597e1aa8ec 100644 --- a/src/chatlog/customtextdocument.h +++ b/src/chatlog/customtextdocument.h @@ -21,7 +21,7 @@ class CustomTextDocument : public QTextDocument CustomTextDocument(SmileyPack& smileyPack, Settings& settings, QObject* parent = nullptr); protected: - virtual QVariant loadResource(int type, const QUrl& name); + QVariant loadResource(int type, const QUrl& name) override; private: QList> emoticonIcons; diff --git a/src/chatlog/pixmapcache.h b/src/chatlog/pixmapcache.h index 9bb436fc9f..829d516613 100644 --- a/src/chatlog/pixmapcache.h +++ b/src/chatlog/pixmapcache.h @@ -15,11 +15,12 @@ class PixmapCache QPixmap get(const QString& filename, QSize size); static PixmapCache& getInstance(); -protected: - PixmapCache() {} PixmapCache(PixmapCache&) = delete; PixmapCache& operator=(const PixmapCache&) = delete; +protected: + PixmapCache() = default; + private: QHash cache; }; diff --git a/src/core/core.h b/src/core/core.h index 860009ad7d..a644ca102f 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -17,7 +17,6 @@ #include "toxpk.h" #include "src/model/status.h" -#include "util/strongtype.h" #include #include @@ -25,7 +24,6 @@ #include #include -#include #include class CoreAV; @@ -67,7 +65,7 @@ class Core : public QObject, Tox* getTox() const; QRecursiveMutex& getCoreLoopLock() const; - ~Core(); + ~Core() override; static const QString TOX_EXT; uint64_t getMaxMessageSize() const; diff --git a/src/core/coreav.h b/src/core/coreav.h index 327f39d6c8..4e65a7cfeb 100644 --- a/src/core/coreav.h +++ b/src/core/coreav.h @@ -41,7 +41,7 @@ class CoreAV : public QObject void setAudio(IAudioControl& newAudio); IAudioControl* getAudio(); - ~CoreAV(); + ~CoreAV() override; bool isCallStarted(const Friend* f) const; bool isCallStarted(const Conference* c) const; diff --git a/src/core/toxcall.h b/src/core/toxcall.h index 4f5593bd69..ff2ffa4682 100644 --- a/src/core/toxcall.h +++ b/src/core/toxcall.h @@ -30,11 +30,11 @@ class ToxCall : public QObject Q_OBJECT protected: - ToxCall() = delete; ToxCall(bool VideoEnabled, CoreAV& av, IAudioControl& audio); - ~ToxCall(); + ~ToxCall() override; public: + ToxCall() = delete; ToxCall(const ToxCall& other) = delete; ToxCall(ToxCall&& other) = delete; @@ -82,7 +82,7 @@ class ToxFriendCall : public ToxCall CameraSource& cameraSource); ToxFriendCall(ToxFriendCall&& other) = delete; ToxFriendCall& operator=(ToxFriendCall&& other) = delete; - ~ToxFriendCall(); + ~ToxFriendCall() override; TOXAV_FRIEND_CALL_STATE getState() const; void setState(const TOXAV_FRIEND_CALL_STATE& value); @@ -109,7 +109,7 @@ class ToxConferenceCall : public ToxCall ToxConferenceCall() = delete; ToxConferenceCall(const Conference& conference_, CoreAV& av_, IAudioControl& audio_); ToxConferenceCall(ToxConferenceCall&& other) = delete; - ~ToxConferenceCall(); + ~ToxConferenceCall() override; ToxConferenceCall& operator=(ToxConferenceCall&& other) = delete; void removePeer(ToxPk peerId); diff --git a/src/ipc.h b/src/ipc.h index 951ea8e8e6..602f7c7483 100644 --- a/src/ipc.h +++ b/src/ipc.h @@ -30,7 +30,7 @@ class IPC : public QObject public: explicit IPC(uint32_t profileId_); - ~IPC(); + ~IPC() override; struct IPCEvent { diff --git a/src/model/chat.cpp b/src/model/chat.cpp index cd925ba0a2..3c45d1be36 100644 --- a/src/model/chat.cpp +++ b/src/model/chat.cpp @@ -7,4 +7,4 @@ #include "chat.h" #include -Chat::~Chat() {} +Chat::~Chat() = default; diff --git a/src/model/chat.h b/src/model/chat.h index 3045ff4bfd..95be72a230 100644 --- a/src/model/chat.h +++ b/src/model/chat.h @@ -14,7 +14,7 @@ class Chat : public QObject { Q_OBJECT public: - virtual ~Chat() = 0; + ~Chat() override; virtual void setName(const QString& name) = 0; virtual QString getDisplayedName() const = 0; diff --git a/src/model/debug/debugobjecttreemodel.cpp b/src/model/debug/debugobjecttreemodel.cpp index e947799093..737ca9d59c 100644 --- a/src/model/debug/debugobjecttreemodel.cpp +++ b/src/model/debug/debugobjecttreemodel.cpp @@ -89,7 +89,7 @@ DebugObjectTreeModel::DebugObjectTreeModel(QObject* parent) reload(); } -DebugObjectTreeModel::~DebugObjectTreeModel() {} +DebugObjectTreeModel::~DebugObjectTreeModel() = default; void DebugObjectTreeModel::reload() { diff --git a/src/model/ichatlog.h b/src/model/ichatlog.h index 6ad4132e25..c23c3dfd83 100644 --- a/src/model/ichatlog.h +++ b/src/model/ichatlog.h @@ -69,7 +69,7 @@ class IChatLog : public QObject { Q_OBJECT public: - virtual ~IChatLog() = default; + ~IChatLog() override = default; /** * @brief Returns reference to item at idx diff --git a/src/model/imessagedispatcher.h b/src/model/imessagedispatcher.h index 4cd6caf2f4..e31451b5db 100644 --- a/src/model/imessagedispatcher.h +++ b/src/model/imessagedispatcher.h @@ -22,7 +22,7 @@ class IMessageDispatcher : public QObject { Q_OBJECT public: - virtual ~IMessageDispatcher(); + ~IMessageDispatcher() override; /** * @brief Sends message to associated chat diff --git a/src/model/notificationgenerator.h b/src/model/notificationgenerator.h index 58522c47a5..4769d21ce0 100644 --- a/src/model/notificationgenerator.h +++ b/src/model/notificationgenerator.h @@ -26,7 +26,7 @@ class NotificationGenerator : public QObject // currently mockable so we allow profile to be nullptr for unit // testing Profile* profile_); - virtual ~NotificationGenerator(); + ~NotificationGenerator() override; NotificationGenerator(const NotificationGenerator&) = delete; NotificationGenerator& operator=(const NotificationGenerator&) = delete; NotificationGenerator(NotificationGenerator&&) = delete; diff --git a/src/model/sessionchatlog.h b/src/model/sessionchatlog.h index 47526b410a..f5d9fd2340 100644 --- a/src/model/sessionchatlog.h +++ b/src/model/sessionchatlog.h @@ -24,7 +24,7 @@ class SessionChatLog : public IChatLog SessionChatLog(ChatLogIdx initialIdx, const ICoreIdHandler& coreIdHandler_, FriendList& friendList, ConferenceList& conferenceList); - ~SessionChatLog(); + ~SessionChatLog() override; const ChatLogItem& at(ChatLogIdx idx) const override; SearchResult searchForward(SearchPos startPos, const QString& phrase, const ParameterSearch& parameter) const override; diff --git a/src/nexus.h b/src/nexus.h index 3cae067460..5a1c2e3bf7 100644 --- a/src/nexus.h +++ b/src/nexus.h @@ -38,7 +38,7 @@ class Nexus : public QObject public: Nexus(Settings& settings, IMessageBoxManager& messageBoxManager, CameraSource& cameraSource, IPC& ipc, QObject* parent = nullptr); - ~Nexus(); + ~Nexus() override; void start(); void showMainGUI(); void setParser(QCommandLineParser* parser_); diff --git a/src/persistence/db/rawdatabase.h b/src/persistence/db/rawdatabase.h index b88d22208d..6107007d80 100644 --- a/src/persistence/db/rawdatabase.h +++ b/src/persistence/db/rawdatabase.h @@ -104,7 +104,7 @@ class RawDatabase : QObject }; RawDatabase(const QString& path_, const QString& password, const QByteArray& salt); - ~RawDatabase(); + ~RawDatabase() override; bool isOpen(); bool execNow(const QString& statement); diff --git a/src/persistence/db/upgrades/dbupgrader.cpp b/src/persistence/db/upgrades/dbupgrader.cpp index e64738777d..58464ece88 100644 --- a/src/persistence/db/upgrades/dbupgrader.cpp +++ b/src/persistence/db/upgrades/dbupgrader.cpp @@ -64,7 +64,7 @@ struct DuplicateAlias , badAliasRows{badAliasRows_} { } - DuplicateAlias() {} + DuplicateAlias() = default; RowId goodAliasRow{-1}; std::vector badAliasRows; }; diff --git a/src/persistence/history.h b/src/persistence/history.h index ce8efae844..68776feac8 100644 --- a/src/persistence/history.h +++ b/src/persistence/history.h @@ -202,7 +202,7 @@ class History : public QObject, public std::enable_shared_from_this public: History(std::shared_ptr db, Settings& settings, IMessageBoxManager& messageBoxManager); - ~History(); + ~History() override; bool isValid(); diff --git a/src/persistence/profile.h b/src/persistence/profile.h index e2194dd7e3..da49f53009 100644 --- a/src/persistence/profile.h +++ b/src/persistence/profile.h @@ -38,7 +38,7 @@ class Profile : public QObject const QCommandLineParser* parser, CameraSource& cameraSource, IMessageBoxManager& messageBoxManager); void save(); - ~Profile(); + ~Profile() override; Core& getCore() const; QString getName() const; diff --git a/src/persistence/profilelocker.h b/src/persistence/profilelocker.h index 2786922847..79d06af4df 100644 --- a/src/persistence/profilelocker.h +++ b/src/persistence/profilelocker.h @@ -13,10 +13,9 @@ class Paths; class ProfileLocker { -private: +public: ProfileLocker() = delete; -public: static bool isLockable(QString profile, Paths& paths); static bool lock(QString profile, Paths& paths); static void unlock(); diff --git a/src/persistence/settings.h b/src/persistence/settings.h index f77f9e1efb..d6de340ed7 100644 --- a/src/persistence/settings.h +++ b/src/persistence/settings.h @@ -135,7 +135,7 @@ class Settings : public QObject, public: explicit Settings(IMessageBoxManager& messageBoxManager); - ~Settings(); + ~Settings() override; Settings(Settings& settings) = delete; Settings& operator=(const Settings&) = delete; diff --git a/src/platform/desktop_notifications/desktopnotify.h b/src/platform/desktop_notifications/desktopnotify.h index 1bea3d6abf..e0700dd61a 100644 --- a/src/platform/desktop_notifications/desktopnotify.h +++ b/src/platform/desktop_notifications/desktopnotify.h @@ -29,7 +29,7 @@ class DesktopNotify : public QObject public: DesktopNotify(INotificationSettings& settings, QObject* parent); - ~DesktopNotify(); + ~DesktopNotify() override; void setIcon(QSystemTrayIcon* icon); diff --git a/src/platform/desktop_notifications/desktopnotifybackend.h b/src/platform/desktop_notifications/desktopnotifybackend.h index 7ace0642d2..623b1a4877 100644 --- a/src/platform/desktop_notifications/desktopnotifybackend.h +++ b/src/platform/desktop_notifications/desktopnotifybackend.h @@ -14,7 +14,7 @@ class DesktopNotifyBackend : public QObject public: explicit DesktopNotifyBackend(QObject* parent); - ~DesktopNotifyBackend(); + ~DesktopNotifyBackend() override; bool showMessage(const QString& title, const QString& message, const QPixmap& pixmap); diff --git a/src/platform/posixsignalnotifier.h b/src/platform/posixsignalnotifier.h index 209b236d8c..ca3c9d5bec 100644 --- a/src/platform/posixsignalnotifier.h +++ b/src/platform/posixsignalnotifier.h @@ -22,7 +22,7 @@ class PosixSignalNotifier : public QObject }; Q_ENUM(UserSignal) - ~PosixSignalNotifier(); + ~PosixSignalNotifier() override; static void watchSignal(int signum); static void watchSignals(std::initializer_list signalSet); diff --git a/src/video/camerasource.h b/src/video/camerasource.h index 1eec6d197b..b73372b303 100644 --- a/src/video/camerasource.h +++ b/src/video/camerasource.h @@ -24,7 +24,7 @@ class CameraSource : public VideoSource public: explicit CameraSource(Settings& settings); - ~CameraSource(); + ~CameraSource() override; void setupDefault(); bool isNone() const; diff --git a/src/video/netcamview.h b/src/video/netcamview.h index fbfedbe14e..8a2bc26511 100644 --- a/src/video/netcamview.h +++ b/src/video/netcamview.h @@ -32,7 +32,7 @@ class NetCamView : public QWidget public: NetCamView(ToxPk friendPk_, CameraSource& cameraSource, Settings& settings, Style& style, Profile& profile, QWidget* parent = nullptr); - ~NetCamView(); + ~NetCamView() override; virtual void show(VideoSource* source, const QString& title); virtual void hide(); @@ -42,7 +42,7 @@ class NetCamView : public QWidget QSize getSurfaceMinSize(); protected: - void showEvent(QShowEvent* event); + void showEvent(QShowEvent* event) override; QVBoxLayout* verLayout; VideoSurface* videoSurface; QPushButton* enterFullScreenButton = nullptr; @@ -71,8 +71,8 @@ private slots: void toggleVideoPreview(); void toggleButtonState(QPushButton* btn); void updateButtonState(QPushButton* btn, bool active); - void keyPressEvent(QKeyEvent* event); - void closeEvent(QCloseEvent* event); + void keyPressEvent(QKeyEvent* event) override; + void closeEvent(QCloseEvent* event) override; VideoSurface* selfVideoSurface; MovableWidget* selfFrame; ToxPk friendPk; diff --git a/src/video/videosource.h b/src/video/videosource.h index e3a5e67764..6f7becf987 100644 --- a/src/video/videosource.h +++ b/src/video/videosource.h @@ -27,7 +27,7 @@ class VideoSource : public QObject { } - virtual ~VideoSource() = default; + ~VideoSource() override = default; /** * @brief If subscribe successfully opens the source, it will start emitting frameAvailable * signals. diff --git a/src/video/videosurface.h b/src/video/videosurface.h index a9007ff0fa..e8d742f652 100644 --- a/src/video/videosurface.h +++ b/src/video/videosurface.h @@ -17,7 +17,7 @@ class VideoSurface : public QWidget public: VideoSurface(const QPixmap& avatar_, QWidget* parent = nullptr, bool expanding_ = false); VideoSurface(const QPixmap& avatar_, VideoSource* source_, QWidget* parent = nullptr); - ~VideoSurface(); + ~VideoSurface() override; bool isExpanding() const; void setSource(VideoSource* src); diff --git a/src/widget/about/aboutfriendform.h b/src/widget/about/aboutfriendform.h index a7e6a01968..f619f5e1ac 100644 --- a/src/widget/about/aboutfriendform.h +++ b/src/widget/about/aboutfriendform.h @@ -27,7 +27,7 @@ class AboutFriendForm : public QDialog public: AboutFriendForm(std::unique_ptr about, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager, QWidget* parent = nullptr); - ~AboutFriendForm(); + ~AboutFriendForm() override; private: Ui::AboutFriendForm* ui; diff --git a/src/widget/chatformheader.h b/src/widget/chatformheader.h index ed1d293592..bdc661e7eb 100644 --- a/src/widget/chatformheader.h +++ b/src/widget/chatformheader.h @@ -47,7 +47,7 @@ class ChatFormHeader : public QWidget }; ChatFormHeader(Settings& settings, Style& style, QWidget* parent = nullptr); - ~ChatFormHeader(); + ~ChatFormHeader() override; void setName(const QString& newName); void setMode(Mode mode_); diff --git a/src/widget/circlewidget.h b/src/widget/circlewidget.h index 18cf017770..2a8fbf841a 100644 --- a/src/widget/circlewidget.h +++ b/src/widget/circlewidget.h @@ -23,7 +23,7 @@ class CircleWidget final : public CategoryWidget CircleWidget(const Core& core_, FriendListWidget* parent, int id_, Settings& settings, Style& style, IMessageBoxManager& messageboxManager, FriendList& friendList, ConferenceList& conferenceList, Profile& profile); - ~CircleWidget(); + ~CircleWidget() override; void editName(); static CircleWidget* getFromID(int id); diff --git a/src/widget/conferencewidget.h b/src/widget/conferencewidget.h index c84abcb246..41b71e1707 100644 --- a/src/widget/conferencewidget.h +++ b/src/widget/conferencewidget.h @@ -22,7 +22,7 @@ class ConferenceWidget final : public GenericChatroomWidget, public IFriendListI public: ConferenceWidget(std::shared_ptr chatroom_, bool compact, Settings& settings, Style& style); - ~ConferenceWidget(); + ~ConferenceWidget() override; void setAsInactiveChatroom() final; void setAsActiveChatroom() final; void updateStatusLight() final; diff --git a/src/widget/contentdialogmanager.h b/src/widget/contentdialogmanager.h index 7877087c21..c5649ab716 100644 --- a/src/widget/contentdialogmanager.h +++ b/src/widget/contentdialogmanager.h @@ -30,8 +30,8 @@ class ContentDialogManager : public QObject, public IDialogsManager ContentDialog* getFriendDialog(const ToxPk& friendPk) const; ContentDialog* getConferenceDialog(const ConferenceId& conferenceId) const; - IDialogs* getFriendDialogs(const ToxPk& friendPk) const; - IDialogs* getConferenceDialogs(const ConferenceId& conferenceId) const; + IDialogs* getFriendDialogs(const ToxPk& friendPk) const override; + IDialogs* getConferenceDialogs(const ConferenceId& conferenceId) const override; FriendWidget* addFriendToDialog(ContentDialog* dialog, std::shared_ptr chatroom, GenericChatForm* form); diff --git a/src/widget/contentlayout.h b/src/widget/contentlayout.h index c3dea6c695..b3ed6de525 100644 --- a/src/widget/contentlayout.h +++ b/src/widget/contentlayout.h @@ -16,7 +16,7 @@ class ContentLayout : public QVBoxLayout public: ContentLayout(Settings& settings, Style& style); explicit ContentLayout(Settings& settings, Style& style, QWidget* parent); - ~ContentLayout(); + ~ContentLayout() override; void clear(); diff --git a/src/widget/flowlayout.h b/src/widget/flowlayout.h index 668f59b8c4..66957e1492 100644 --- a/src/widget/flowlayout.h +++ b/src/widget/flowlayout.h @@ -13,7 +13,7 @@ class FlowLayout : public QLayout public: explicit FlowLayout(QWidget* parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); - ~FlowLayout(); + ~FlowLayout() override; void addItem(QLayoutItem* item) override; int horizontalSpacing() const; diff --git a/src/widget/form/addfriendform.h b/src/widget/form/addfriendform.h index 9fcfbe10ce..b64b9acc13 100644 --- a/src/widget/form/addfriendform.h +++ b/src/widget/form/addfriendform.h @@ -38,7 +38,7 @@ class AddFriendForm : public QObject IMessageBoxManager& messageBoxManager, Core& core); AddFriendForm(const AddFriendForm&) = delete; AddFriendForm& operator=(const AddFriendForm&) = delete; - ~AddFriendForm(); + ~AddFriendForm() override; bool isShown() const; void show(ContentLayout* contentLayout); diff --git a/src/widget/form/conferenceform.h b/src/widget/form/conferenceform.h index 3cc158a3e2..98e46d8d46 100644 --- a/src/widget/form/conferenceform.h +++ b/src/widget/form/conferenceform.h @@ -37,7 +37,7 @@ class ConferenceForm : public GenericChatForm DocumentCache& documentCache, SmileyPack& smileyPack, Style& style, IMessageBoxManager& messageBoxManager, FriendList& friendList, ConferenceList& conferenceList); - ~ConferenceForm(); + ~ConferenceForm() override; void peerAudioPlaying(ToxPk peerPk); diff --git a/src/widget/form/conferenceinviteform.h b/src/widget/form/conferenceinviteform.h index 84bf2519ee..0d22abbbc7 100644 --- a/src/widget/form/conferenceinviteform.h +++ b/src/widget/form/conferenceinviteform.h @@ -28,7 +28,7 @@ class ConferenceInviteForm : public QWidget Q_OBJECT public: ConferenceInviteForm(Settings& settings, Core& core); - ~ConferenceInviteForm(); + ~ConferenceInviteForm() override; void show(ContentLayout* contentLayout); bool addConferenceInvite(const ConferenceInvite& inviteInfo); diff --git a/src/widget/form/debug/debuglog.h b/src/widget/form/debug/debuglog.h index 79b357ad23..bfc2918fbc 100644 --- a/src/widget/form/debug/debuglog.h +++ b/src/widget/form/debug/debuglog.h @@ -22,7 +22,7 @@ class DebugLogForm final : public GenericForm Q_OBJECT public: DebugLogForm(Paths& paths, Style& style, QWidget* parent); - ~DebugLogForm(); + ~DebugLogForm() override; QString getFormName() final { return tr("Debug Log"); diff --git a/src/widget/form/debug/debugobjecttree.cpp b/src/widget/form/debug/debugobjecttree.cpp index 1d5725acf7..8a62ea373c 100644 --- a/src/widget/form/debug/debugobjecttree.cpp +++ b/src/widget/form/debug/debugobjecttree.cpp @@ -20,4 +20,4 @@ DebugObjectTree::DebugObjectTree(Style& style, QWidget* parent) connect(ui_->btnReload, &QPushButton::clicked, model_, &DebugObjectTreeModel::reload); } -DebugObjectTree::~DebugObjectTree() {} +DebugObjectTree::~DebugObjectTree() = default; diff --git a/src/widget/form/debug/debugobjecttree.h b/src/widget/form/debug/debugobjecttree.h index 3121594d9b..dc414de0cf 100644 --- a/src/widget/form/debug/debugobjecttree.h +++ b/src/widget/form/debug/debugobjecttree.h @@ -22,7 +22,7 @@ class DebugObjectTree : public GenericForm public: explicit DebugObjectTree(Style& style, QWidget* parent = nullptr); - ~DebugObjectTree(); + ~DebugObjectTree() override; QString getFormName() final { diff --git a/src/widget/form/debugwidget.h b/src/widget/form/debugwidget.h index a541d3c5b4..8debaded22 100644 --- a/src/widget/form/debugwidget.h +++ b/src/widget/form/debugwidget.h @@ -21,7 +21,7 @@ class DebugWidget : public QWidget Q_OBJECT public: DebugWidget(Paths& paths, Style& style, Widget* parent = nullptr); - ~DebugWidget(); + ~DebugWidget() override; bool isShown() const; void show(ContentLayout* contentLayout); diff --git a/src/widget/form/filesform.h b/src/widget/form/filesform.h index e525424dac..4786da908a 100644 --- a/src/widget/form/filesform.h +++ b/src/widget/form/filesform.h @@ -34,7 +34,7 @@ class FilesForm : public QObject public: FilesForm(CoreFile& coreFile, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager, FriendList& friendList); - ~FilesForm(); + ~FilesForm() override; bool isShown() const; void show(ContentLayout* contentLayout); diff --git a/src/widget/form/filetransferlist.h b/src/widget/form/filetransferlist.h index c0c3f2a8fa..c6a70522e0 100644 --- a/src/widget/form/filetransferlist.h +++ b/src/widget/form/filetransferlist.h @@ -42,7 +42,7 @@ class Model : public QAbstractTableModel Q_OBJECT public: Model(FriendList& friendList, QObject* parent = nullptr); - ~Model() = default; + ~Model() override = default; void onFileUpdated(const ToxFile& file); @@ -82,6 +82,6 @@ class View : public QTableView { public: View(QAbstractItemModel* model, Settings& settings, Style& style, QWidget* parent = nullptr); - ~View(); + ~View() override; }; } // namespace FileTransferList diff --git a/src/widget/form/loadhistorydialog.h b/src/widget/form/loadhistorydialog.h index 975ef04cea..8f207281ec 100644 --- a/src/widget/form/loadhistorydialog.h +++ b/src/widget/form/loadhistorydialog.h @@ -21,7 +21,7 @@ class LoadHistoryDialog : public QDialog public: explicit LoadHistoryDialog(const IChatLog* chatLog_, QWidget* parent = nullptr); explicit LoadHistoryDialog(QWidget* parent = nullptr); - ~LoadHistoryDialog(); + ~LoadHistoryDialog() override; QDateTime getFromDate(); void setTitle(const QString& title); diff --git a/src/widget/form/profileform.h b/src/widget/form/profileform.h index 012e616a23..d220ef2af6 100644 --- a/src/widget/form/profileform.h +++ b/src/widget/form/profileform.h @@ -44,7 +44,7 @@ class ProfileForm : public QWidget public: ProfileForm(IProfileInfo* profileInfo_, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager, QWidget* parent = nullptr); - ~ProfileForm(); + ~ProfileForm() override; void show(ContentLayout* contentLayout); bool isShown() const; @@ -71,7 +71,7 @@ private slots: private: void retranslateUi(); void prFileLabelUpdate(); - bool eventFilter(QObject* object, QEvent* event); + bool eventFilter(QObject* object, QEvent* event) override; void refreshProfiles(); static QString getSupportedImageFilter(); diff --git a/src/widget/form/searchsettingsform.h b/src/widget/form/searchsettingsform.h index 6f513e8095..74c4fdb2b5 100644 --- a/src/widget/form/searchsettingsform.h +++ b/src/widget/form/searchsettingsform.h @@ -20,7 +20,7 @@ class SearchSettingsForm : public QWidget public: SearchSettingsForm(Settings& settings, Style& style, QWidget* parent = nullptr); - ~SearchSettingsForm(); + ~SearchSettingsForm() override; ParameterSearch getParameterSearch(); void reloadTheme(); diff --git a/src/widget/form/setpassworddialog.h b/src/widget/form/setpassworddialog.h index 7dfb34955b..301ddfd6b9 100644 --- a/src/widget/form/setpassworddialog.h +++ b/src/widget/form/setpassworddialog.h @@ -23,7 +23,7 @@ class SetPasswordDialog : public QDialog Tertiary }; explicit SetPasswordDialog(QString body_, QString extraButton, QWidget* parent = nullptr); - ~SetPasswordDialog(); + ~SetPasswordDialog() override; QString getPassword(); static int getPasswordStrength(QString pass); diff --git a/src/widget/form/settings/aboutform.h b/src/widget/form/settings/aboutform.h index 551fa98e08..fe6b6061af 100644 --- a/src/widget/form/settings/aboutform.h +++ b/src/widget/form/settings/aboutform.h @@ -25,7 +25,7 @@ class AboutForm : public GenericForm Q_OBJECT public: AboutForm(UpdateCheck& updateCheck_, QString contactInfo_, Style& style_); - ~AboutForm(); + ~AboutForm() override; QString getFormName() final { return tr("About"); diff --git a/src/widget/form/settings/advancedform.h b/src/widget/form/settings/advancedform.h index 6a941cc3fc..2ab0a21bf0 100644 --- a/src/widget/form/settings/advancedform.h +++ b/src/widget/form/settings/advancedform.h @@ -21,7 +21,7 @@ class AdvancedForm : public GenericForm Q_OBJECT public: AdvancedForm(Settings& settings, Style& style, IMessageBoxManager& messageBoxManager); - ~AdvancedForm(); + ~AdvancedForm() override; QString getFormName() final { return tr("Advanced"); diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h index 019402221b..588c0a762c 100644 --- a/src/widget/form/settings/generalform.h +++ b/src/widget/form/settings/generalform.h @@ -20,7 +20,7 @@ class GeneralForm final : public GenericForm Q_OBJECT public: GeneralForm(Settings& settings, Style& style); - ~GeneralForm(); + ~GeneralForm() override; QString getFormName() final { return tr("General"); diff --git a/src/widget/form/settings/genericsettings.h b/src/widget/form/settings/genericsettings.h index 52d7849252..8044d26418 100644 --- a/src/widget/form/settings/genericsettings.h +++ b/src/widget/form/settings/genericsettings.h @@ -14,7 +14,7 @@ class GenericForm : public QWidget Q_OBJECT public: GenericForm(const QPixmap& icon, Style& style, QWidget* parent = nullptr); - virtual ~GenericForm() {} + ~GenericForm() override = default; virtual QString getFormName() = 0; QPixmap getFormIcon(); diff --git a/src/widget/form/settings/privacyform.h b/src/widget/form/settings/privacyform.h index 17f38b0296..6e954d8ec9 100644 --- a/src/widget/form/settings/privacyform.h +++ b/src/widget/form/settings/privacyform.h @@ -21,7 +21,7 @@ class PrivacyForm : public GenericForm Q_OBJECT public: PrivacyForm(Core* core_, Settings& settings, Style& style, Profile& profile); - ~PrivacyForm(); + ~PrivacyForm() override; QString getFormName() final { return tr("Privacy"); diff --git a/src/widget/form/settings/userinterfaceform.h b/src/widget/form/settings/userinterfaceform.h index 4c65a8120f..fb4e84da0d 100644 --- a/src/widget/form/settings/userinterfaceform.h +++ b/src/widget/form/settings/userinterfaceform.h @@ -23,7 +23,7 @@ class UserInterfaceForm : public GenericForm public: UserInterfaceForm(SmileyPack& smileyPack, Settings& settings, Style& style, SettingsWidget* myParent); - ~UserInterfaceForm(); + ~UserInterfaceForm() override; QString getFormName() final { return tr("User Interface"); diff --git a/src/widget/form/settingswidget.h b/src/widget/form/settingswidget.h index bee94be4ef..2fedfdee19 100644 --- a/src/widget/form/settingswidget.h +++ b/src/widget/form/settingswidget.h @@ -38,7 +38,7 @@ class SettingsWidget : public QWidget SettingsWidget(UpdateCheck& updateCheck, IAudioControl& audio, Core* core, SmileyPack& smileyPack, CameraSource& cameraSource, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager, Profile& profile, Widget* parent = nullptr); - ~SettingsWidget(); + ~SettingsWidget() override; bool isShown() const; void show(ContentLayout* contentLayout); diff --git a/src/widget/friendlistwidget.h b/src/widget/friendlistwidget.h index b97cacc502..c7e0fcb6b2 100644 --- a/src/widget/friendlistwidget.h +++ b/src/widget/friendlistwidget.h @@ -39,7 +39,7 @@ class FriendListWidget : public QWidget FriendListWidget(const Core& core, Widget* parent, Settings& settings, Style& style, IMessageBoxManager& messageBoxManager, FriendList& friendList, ConferenceList& conferenceList, Profile& profile, bool conferencesOnTop = true); - ~FriendListWidget(); + ~FriendListWidget() override; void setMode(SortingMode mode); SortingMode getMode() const; diff --git a/src/widget/imagepreviewwidget.h b/src/widget/imagepreviewwidget.h index 5f4c61b18e..2b62e67518 100644 --- a/src/widget/imagepreviewwidget.h +++ b/src/widget/imagepreviewwidget.h @@ -16,7 +16,7 @@ class ImagePreviewButton : public QPushButton : QPushButton(parent) { } - ~ImagePreviewButton(); + ~ImagePreviewButton() override; ImagePreviewButton(const ImagePreviewButton&) = delete; ImagePreviewButton& operator=(const ImagePreviewButton&) = delete; ImagePreviewButton(ImagePreviewButton&&) = delete; diff --git a/src/widget/loginscreen.h b/src/widget/loginscreen.h index 5aeadbf105..0d71f71b13 100644 --- a/src/widget/loginscreen.h +++ b/src/widget/loginscreen.h @@ -24,7 +24,7 @@ class LoginScreen : public QDialog public: LoginScreen(Paths& paths, Style& style, int themeColor, const QString& initialProfileName = QString(), QWidget* parent = nullptr); - ~LoginScreen(); + ~LoginScreen() override; bool event(QEvent* event) final; signals: diff --git a/src/widget/passwordedit.h b/src/widget/passwordedit.h index c2630b8491..0b2d93811f 100644 --- a/src/widget/passwordedit.h +++ b/src/widget/passwordedit.h @@ -15,11 +15,11 @@ class PasswordEdit : public QLineEdit Q_OBJECT public: explicit PasswordEdit(QWidget* parent); - ~PasswordEdit(); + ~PasswordEdit() override; protected: - virtual void showEvent(QShowEvent* event); - virtual void hideEvent(QHideEvent* event); + void showEvent(QShowEvent* event) override; + void hideEvent(QHideEvent* event) override; private: class EventHandler : QObject @@ -28,9 +28,9 @@ class PasswordEdit : public QLineEdit QVector actions; EventHandler(); - ~EventHandler(); + ~EventHandler() override; void updateActions(); - bool eventFilter(QObject* obj, QEvent* event); + bool eventFilter(QObject* obj, QEvent* event) override; }; void registerHandler(); diff --git a/src/widget/qrwidget.h b/src/widget/qrwidget.h index d2e3131afa..69d49d2d5b 100644 --- a/src/widget/qrwidget.h +++ b/src/widget/qrwidget.h @@ -14,7 +14,7 @@ class QRWidget : public QWidget public: explicit QRWidget(QWidget* parent = nullptr); - ~QRWidget(); + ~QRWidget() override; void setQRData(const QString& data_); QImage* getImage(); bool saveImage(QString path); diff --git a/src/widget/tool/adjustingscrollarea.h b/src/widget/tool/adjustingscrollarea.h index 785427afef..75083807d3 100644 --- a/src/widget/tool/adjustingscrollarea.h +++ b/src/widget/tool/adjustingscrollarea.h @@ -12,7 +12,7 @@ class AdjustingScrollArea : public QScrollArea Q_OBJECT public: explicit AdjustingScrollArea(QWidget* parent = nullptr); - virtual ~AdjustingScrollArea() = default; + ~AdjustingScrollArea() override = default; protected: void resizeEvent(QResizeEvent* ev) override; diff --git a/src/widget/tool/chattextedit.h b/src/widget/tool/chattextedit.h index bb550ede44..9c899fba31 100644 --- a/src/widget/tool/chattextedit.h +++ b/src/widget/tool/chattextedit.h @@ -12,7 +12,7 @@ class ChatTextEdit final : public QTextEdit Q_OBJECT public: explicit ChatTextEdit(QWidget* parent = nullptr); - ~ChatTextEdit(); + ~ChatTextEdit() override; void setLastMessage(QString lm); void sendKeyEvent(QKeyEvent* event); diff --git a/src/widget/tool/flyoutoverlaywidget.cpp b/src/widget/tool/flyoutoverlaywidget.cpp index 875363a46b..8607e2fcd9 100644 --- a/src/widget/tool/flyoutoverlaywidget.cpp +++ b/src/widget/tool/flyoutoverlaywidget.cpp @@ -27,7 +27,7 @@ FlyoutOverlayWidget::FlyoutOverlayWidget(QWidget* parent) hide(); } -FlyoutOverlayWidget::~FlyoutOverlayWidget() {} +FlyoutOverlayWidget::~FlyoutOverlayWidget() = default; int FlyoutOverlayWidget::animationDuration() const { diff --git a/src/widget/tool/flyoutoverlaywidget.h b/src/widget/tool/flyoutoverlaywidget.h index 1da0c91ea3..64a54967c3 100644 --- a/src/widget/tool/flyoutoverlaywidget.h +++ b/src/widget/tool/flyoutoverlaywidget.h @@ -16,7 +16,7 @@ class FlyoutOverlayWidget : public QWidget Q_PROPERTY(qreal flyoutPercent READ flyoutPercent WRITE setFlyoutPercent) public: explicit FlyoutOverlayWidget(QWidget* parent = nullptr); - ~FlyoutOverlayWidget(); + ~FlyoutOverlayWidget() override; int animationDuration() const; void setAnimationDuration(int timeMs); diff --git a/src/widget/tool/movablewidget.h b/src/widget/tool/movablewidget.h index d62fb5c325..16a780265b 100644 --- a/src/widget/tool/movablewidget.h +++ b/src/widget/tool/movablewidget.h @@ -17,10 +17,10 @@ class MovableWidget : public QWidget void setRatio(float r); protected: - void mousePressEvent(QMouseEvent* event); - void mouseMoveEvent(QMouseEvent* event); - void mouseReleaseEvent(QMouseEvent* event); - void mouseDoubleClickEvent(QMouseEvent* event); + void mousePressEvent(QMouseEvent* event) override; + void mouseMoveEvent(QMouseEvent* event) override; + void mouseReleaseEvent(QMouseEvent* event) override; + void mouseDoubleClickEvent(QMouseEvent* event) override; private: void checkBoundary(QPoint& point) const; diff --git a/src/widget/tool/screengrabberchooserrectitem.cpp b/src/widget/tool/screengrabberchooserrectitem.cpp index 82694051dc..d099aebefa 100644 --- a/src/widget/tool/screengrabberchooserrectitem.cpp +++ b/src/widget/tool/screengrabberchooserrectitem.cpp @@ -41,7 +41,7 @@ ScreenGrabberChooserRectItem::ScreenGrabberChooserRectItem(QGraphicsScene* scene hideHandles(); } -ScreenGrabberChooserRectItem::~ScreenGrabberChooserRectItem() {} +ScreenGrabberChooserRectItem::~ScreenGrabberChooserRectItem() = default; QRectF ScreenGrabberChooserRectItem::boundingRect() const { diff --git a/src/widget/tool/screengrabberchooserrectitem.h b/src/widget/tool/screengrabberchooserrectitem.h index 2b3c413c28..955cdd1bb4 100644 --- a/src/widget/tool/screengrabberchooserrectitem.h +++ b/src/widget/tool/screengrabberchooserrectitem.h @@ -12,7 +12,7 @@ class ScreenGrabberChooserRectItem final : public QObject, public QGraphicsItemG Q_OBJECT public: explicit ScreenGrabberChooserRectItem(QGraphicsScene* scene); - ~ScreenGrabberChooserRectItem(); + ~ScreenGrabberChooserRectItem() override; QRectF boundingRect() const final; void beginResize(QPointF mousePos); diff --git a/src/widget/tool/screengrabberoverlayitem.cpp b/src/widget/tool/screengrabberoverlayitem.cpp index 9235e710a5..1e14cd7208 100644 --- a/src/widget/tool/screengrabberoverlayitem.cpp +++ b/src/widget/tool/screengrabberoverlayitem.cpp @@ -22,7 +22,7 @@ ScreenGrabberOverlayItem::ScreenGrabberOverlayItem(ScreenshotGrabber* grabber) setPen(QPen(Qt::NoPen)); } -ScreenGrabberOverlayItem::~ScreenGrabberOverlayItem() {} +ScreenGrabberOverlayItem::~ScreenGrabberOverlayItem() = default; void ScreenGrabberOverlayItem::setChosenRect(QRect rect) { diff --git a/src/widget/tool/screengrabberoverlayitem.h b/src/widget/tool/screengrabberoverlayitem.h index f39e9ba4bd..09d695bbaa 100644 --- a/src/widget/tool/screengrabberoverlayitem.h +++ b/src/widget/tool/screengrabberoverlayitem.h @@ -14,7 +14,7 @@ class ScreenGrabberOverlayItem final : public QObject, public QGraphicsRectItem Q_OBJECT public: explicit ScreenGrabberOverlayItem(ScreenshotGrabber* grabber); - ~ScreenGrabberOverlayItem(); + ~ScreenGrabberOverlayItem() override; void setChosenRect(QRect rect); diff --git a/src/widget/tool/toolboxgraphicsitem.cpp b/src/widget/tool/toolboxgraphicsitem.cpp index 4c57b9bfaa..5e18e5d5a5 100644 --- a/src/widget/tool/toolboxgraphicsitem.cpp +++ b/src/widget/tool/toolboxgraphicsitem.cpp @@ -18,7 +18,7 @@ ToolBoxGraphicsItem::ToolBoxGraphicsItem() setOpacity(activeOpacity); } -ToolBoxGraphicsItem::~ToolBoxGraphicsItem() {} +ToolBoxGraphicsItem::~ToolBoxGraphicsItem() = default; void ToolBoxGraphicsItem::hoverEnterEvent(QGraphicsSceneHoverEvent* event) { diff --git a/src/widget/tool/toolboxgraphicsitem.h b/src/widget/tool/toolboxgraphicsitem.h index 2c0b55ad59..830fe083b3 100644 --- a/src/widget/tool/toolboxgraphicsitem.h +++ b/src/widget/tool/toolboxgraphicsitem.h @@ -15,7 +15,7 @@ class ToolBoxGraphicsItem final : public QObject, public QGraphicsItemGroup Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) public: ToolBoxGraphicsItem(); - ~ToolBoxGraphicsItem(); + ~ToolBoxGraphicsItem() override; void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) final; diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 618b4b389c..5059297f1c 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1860,7 +1860,7 @@ ContentLayout* Widget::createContentDialog(DialogType type) const connect(core, &Core::usernameSet, this, &Dialog::retranslateUi); } - ~Dialog() + ~Dialog() override { Translator::unregister(this); } diff --git a/test/mock/include/mock/mockconferencequery.h b/test/mock/include/mock/mockconferencequery.h index 330c173985..f37b03ff0d 100644 --- a/test/mock/include/mock/mockconferencequery.h +++ b/test/mock/include/mock/mockconferencequery.h @@ -14,7 +14,7 @@ class MockConferenceQuery : public ICoreConferenceQuery { public: MockConferenceQuery() = default; - virtual ~MockConferenceQuery(); + ~MockConferenceQuery() override; MockConferenceQuery(const MockConferenceQuery&) = default; MockConferenceQuery& operator=(const MockConferenceQuery&) = default; MockConferenceQuery(MockConferenceQuery&&) = default; @@ -23,7 +23,7 @@ class MockConferenceQuery : public ICoreConferenceQuery ConferenceId getConferencePersistentId(uint32_t conferenceNumber) const override { std::ignore = conferenceNumber; - return ConferenceId(0); + return ConferenceId(nullptr); } uint32_t getConferenceNumberPeers(int conferenceId) const override diff --git a/test/mock/include/mock/mockcoreidhandler.h b/test/mock/include/mock/mockcoreidhandler.h index ec7ab28ef7..cd0402ef7d 100644 --- a/test/mock/include/mock/mockcoreidhandler.h +++ b/test/mock/include/mock/mockcoreidhandler.h @@ -11,7 +11,7 @@ class MockCoreIdHandler : public ICoreIdHandler { public: MockCoreIdHandler() = default; - virtual ~MockCoreIdHandler(); + ~MockCoreIdHandler() override; MockCoreIdHandler(const MockCoreIdHandler&) = default; MockCoreIdHandler& operator=(const MockCoreIdHandler&) = default; MockCoreIdHandler(MockCoreIdHandler&&) = default; diff --git a/test/mock/include/mock/mockcoresettings.h b/test/mock/include/mock/mockcoresettings.h index 9d9eb2bb0b..83c63c5da5 100644 --- a/test/mock/include/mock/mockcoresettings.h +++ b/test/mock/include/mock/mockcoresettings.h @@ -22,7 +22,7 @@ class MockSettings : public QObject, public ICoreSettings Q_INIT_RESOURCE(res); } - ~MockSettings(); + ~MockSettings() override; bool getEnableIPv6() const override { diff --git a/test/model/conferencemessagedispatcher_test.cpp b/test/model/conferencemessagedispatcher_test.cpp index 34863ec20d..49287f5b27 100644 --- a/test/model/conferencemessagedispatcher_test.cpp +++ b/test/model/conferencemessagedispatcher_test.cpp @@ -133,7 +133,7 @@ private slots: std::unique_ptr friendList; }; -TestConferenceMessageDispatcher::TestConferenceMessageDispatcher() {} +TestConferenceMessageDispatcher::TestConferenceMessageDispatcher() = default; /** * @brief Test initialization. Resets all members to initial state diff --git a/test/model/friendlistmanager_test.cpp b/test/model/friendlistmanager_test.cpp index 0ed77e8a2c..de82139a48 100644 --- a/test/model/friendlistmanager_test.cpp +++ b/test/model/friendlistmanager_test.cpp @@ -25,7 +25,7 @@ class MockFriend : public IFriendListItem { } - ~MockFriend(); + ~MockFriend() override; bool isFriend() const override { @@ -84,7 +84,7 @@ class MockConference : public IFriendListItem { } - ~MockConference(); + ~MockConference() override; bool isFriend() const override { diff --git a/test/model/friendmessagedispatcher_test.cpp b/test/model/friendmessagedispatcher_test.cpp index 1071c57793..ff93de5356 100644 --- a/test/model/friendmessagedispatcher_test.cpp +++ b/test/model/friendmessagedispatcher_test.cpp @@ -105,7 +105,7 @@ private slots: std::deque receivedMessages; }; -TestFriendMessageDispatcher::TestFriendMessageDispatcher() {} +TestFriendMessageDispatcher::TestFriendMessageDispatcher() = default; /** * @brief Test initialization. Resets all member variables for a fresh test state diff --git a/test/model/messageprocessor_test.cpp b/test/model/messageprocessor_test.cpp index dd4222feeb..da01455615 100644 --- a/test/model/messageprocessor_test.cpp +++ b/test/model/messageprocessor_test.cpp @@ -25,7 +25,7 @@ class TestMessageProcessor : public QObject Q_OBJECT public: - TestMessageProcessor() {} + TestMessageProcessor() = default; private slots: void testSelfMention(); diff --git a/test/model/notificationgenerator_test.cpp b/test/model/notificationgenerator_test.cpp index 6a194e94d7..ab5b1345c5 100644 --- a/test/model/notificationgenerator_test.cpp +++ b/test/model/notificationgenerator_test.cpp @@ -15,75 +15,75 @@ namespace { class MockNotificationSettings : public INotificationSettings { - virtual bool getNotify() const override + bool getNotify() const override { return true; } - virtual void setNotify(bool newValue) override + void setNotify(bool newValue) override { std::ignore = newValue; } - virtual bool getShowWindow() const override + bool getShowWindow() const override { return true; } - virtual void setShowWindow(bool newValue) override + void setShowWindow(bool newValue) override { std::ignore = newValue; } - virtual bool getDesktopNotify() const override + bool getDesktopNotify() const override { return true; } - virtual void setDesktopNotify(bool newValue) override + void setDesktopNotify(bool enabled) override { - std::ignore = newValue; + std::ignore = enabled; } - virtual bool getNotifySystemBackend() const override + bool getNotifySystemBackend() const override { return true; } - virtual void setNotifySystemBackend(bool newValue) override + void setNotifySystemBackend(bool newValue) override { std::ignore = newValue; } - virtual bool getNotifySound() const override + bool getNotifySound() const override { return true; } - virtual void setNotifySound(bool newValue) override + void setNotifySound(bool newValue) override { std::ignore = newValue; } - virtual bool getNotifyHide() const override + bool getNotifyHide() const override { return notifyHide; } - virtual void setNotifyHide(bool newValue) override + void setNotifyHide(bool newValue) override { notifyHide = newValue; } - virtual bool getBusySound() const override + bool getBusySound() const override { return true; } - virtual void setBusySound(bool newValue) override + void setBusySound(bool newValue) override { std::ignore = newValue; } - virtual bool getConferenceAlwaysNotify() const override + bool getConferenceAlwaysNotify() const override { return true; } - virtual void setConferenceAlwaysNotify(bool newValue) override + void setConferenceAlwaysNotify(bool newValue) override { std::ignore = newValue; } @@ -178,7 +178,7 @@ void TestNotificationGenerator::testNotificationClear() void TestNotificationGenerator::testConferenceMessage() { - Conference g(0, ConferenceId(0), "conferenceName", false, "selfName", *conferenceQuery, + Conference g(0, ConferenceId(nullptr), "conferenceName", false, "selfName", *conferenceQuery, *coreIdHandler, *friendList); auto sender = conferenceQuery->getConferencePeerPk(0, 0); g.updateUsername(sender, "sender1"); @@ -190,7 +190,7 @@ void TestNotificationGenerator::testConferenceMessage() void TestNotificationGenerator::testMultipleConferenceMessages() { - Conference g(0, ConferenceId(0), "conferenceName", false, "selfName", *conferenceQuery, + Conference g(0, ConferenceId(nullptr), "conferenceName", false, "selfName", *conferenceQuery, *coreIdHandler, *friendList); auto sender = conferenceQuery->getConferencePeerPk(0, 0); @@ -361,7 +361,7 @@ void TestNotificationGenerator::testSimpleFileTransfer() void TestNotificationGenerator::testSimpleConferenceMessage() { - Conference g(0, ConferenceId(0), "conferenceName", false, "selfName", *conferenceQuery, + Conference g(0, ConferenceId(nullptr), "conferenceName", false, "selfName", *conferenceQuery, *coreIdHandler, *friendList); auto sender = conferenceQuery->getConferencePeerPk(0, 0); g.updateUsername(sender, "sender1"); diff --git a/test/model/sessionchatlog_test.cpp b/test/model/sessionchatlog_test.cpp index 0faed7f70e..a8c26104ac 100644 --- a/test/model/sessionchatlog_test.cpp +++ b/test/model/sessionchatlog_test.cpp @@ -47,7 +47,7 @@ class TestSessionChatLog : public QObject Q_OBJECT public: - TestSessionChatLog() {} + TestSessionChatLog() = default; private slots: void init(); diff --git a/test/persistence/offlinemsgengine_test.cpp b/test/persistence/offlinemsgengine_test.cpp index 96556bd644..7af92cd9f7 100644 --- a/test/persistence/offlinemsgengine_test.cpp +++ b/test/persistence/offlinemsgengine_test.cpp @@ -3,9 +3,6 @@ * Copyright © 2024-2025 The TokTok team. */ -#include "src/core/core.h" -#include "src/model/friend.h" -#include "src/model/status.h" #include "src/persistence/offlinemsgengine.h" #include @@ -128,7 +125,6 @@ void TestOfflineMsgEngine::testCallback() size_t numCallbacks = 0; auto callback = [&numCallbacks](bool) { numCallbacks++; }; Message msg{false, QString(), QDateTime(), {}}; - ReceiptNum receipt; offlineMsgEngine.addSentCoreMessage(ReceiptNum(1), Message(), callback); offlineMsgEngine.addSentCoreMessage(ReceiptNum(2), Message(), callback); diff --git a/util/include/util/strongtype.h b/util/include/util/strongtype.h index e36dca3f39..397090fb14 100644 --- a/util/include/util/strongtype.h +++ b/util/include/util/strongtype.h @@ -123,7 +123,7 @@ class NamedType : public Properties, T>... public: using UnderlyingType = T; - NamedType() {} + NamedType() = default; explicit NamedType(const T& value) : value_(value) {