From 080cb20552aee569caf28b824e3d083401de738b Mon Sep 17 00:00:00 2001 From: Valentino Orlandi Date: Mon, 12 Feb 2024 20:36:43 +0100 Subject: [PATCH] Code improvements Deleted move and copy for classes which don't need them --- logdoctor/mainwindow.h | 2 +- logdoctor/modules/changelog/changelog.h | 1 + logdoctor/modules/craphelp/craphelp.h | 1 + logdoctor/modules/crapinfo/crapinfo.h | 2 +- logdoctor/modules/craplog/craplog.h | 2 ++ logdoctor/modules/crapup/crapup.h | 5 +---- logdoctor/modules/crapview/crapview.h | 3 +++ logdoctor/modules/crapview/modules/query.h | 3 +++ logdoctor/modules/dialogs/boolean_dialog.h | 2 +- logdoctor/modules/dialogs/ida_dialog.h | 2 +- logdoctor/modules/dialogs/message_dialog.h | 2 +- logdoctor/tools/crapnote/crapnote.h | 2 ++ logdoctor/tools/crappath/crappath.h | 1 + 13 files changed, 19 insertions(+), 9 deletions(-) diff --git a/logdoctor/mainwindow.h b/logdoctor/mainwindow.h index 731f9191..a827a330 100644 --- a/logdoctor/mainwindow.h +++ b/logdoctor/mainwindow.h @@ -52,7 +52,7 @@ class MainWindow final : public QMainWindow public: explicit MainWindow( QWidget* parent=nullptr ); - + Q_DISABLE_COPY_MOVE(MainWindow) signals: diff --git a/logdoctor/modules/changelog/changelog.h b/logdoctor/modules/changelog/changelog.h index a71d9cdb..e4568e2b 100644 --- a/logdoctor/modules/changelog/changelog.h +++ b/logdoctor/modules/changelog/changelog.h @@ -22,6 +22,7 @@ class Changelog : public QWidget public: explicit Changelog( const QFont& font, const QFont& tb_font, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Changelog) //! Sets the given font for the changelog info void setTextFont( const QFont& font ) noexcept; diff --git a/logdoctor/modules/craphelp/craphelp.h b/logdoctor/modules/craphelp/craphelp.h index 9b7ce084..463fe6eb 100644 --- a/logdoctor/modules/craphelp/craphelp.h +++ b/logdoctor/modules/craphelp/craphelp.h @@ -25,6 +25,7 @@ class Craphelp final : public QWidget public: explicit Craphelp( QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Craphelp) //! Provides help about log formats /*! diff --git a/logdoctor/modules/crapinfo/crapinfo.h b/logdoctor/modules/crapinfo/crapinfo.h index 6d87937d..77c1d10d 100644 --- a/logdoctor/modules/crapinfo/crapinfo.h +++ b/logdoctor/modules/crapinfo/crapinfo.h @@ -20,7 +20,6 @@ class Crapinfo final : public QWidget public: - //! Class constructor /*! \param version The version of LogDoctor actually running \param exec_path The path of the executable @@ -29,6 +28,7 @@ public: \param parent The parent Widget */ explicit Crapinfo( const QString& version, const QString& exec_path, const QString& conf_path, const QString& logdoc_path, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Crapinfo) private: QSharedPointer ui; diff --git a/logdoctor/modules/craplog/craplog.h b/logdoctor/modules/craplog/craplog.h index 97cabc4a..b5121273 100644 --- a/logdoctor/modules/craplog/craplog.h +++ b/logdoctor/modules/craplog/craplog.h @@ -27,7 +27,9 @@ class Craplog final : public QObject Q_OBJECT public: + explicit Craplog(); + Q_DISABLE_COPY_MOVE(Craplog) ///////////////// diff --git a/logdoctor/modules/crapup/crapup.h b/logdoctor/modules/crapup/crapup.h index 0cd33f28..ee2f876f 100644 --- a/logdoctor/modules/crapup/crapup.h +++ b/logdoctor/modules/crapup/crapup.h @@ -24,12 +24,9 @@ class Crapup final : public QWidget public: - //! Class constructor - /*! - \param parent The parent Widget - */ explicit Crapup( QWidget* parent=nullptr ); ~Crapup(); + Q_DISABLE_COPY_MOVE(Crapup) //! Performs a version check diff --git a/logdoctor/modules/crapview/crapview.h b/logdoctor/modules/crapview/crapview.h index 769b1a17..b191665d 100644 --- a/logdoctor/modules/crapview/crapview.h +++ b/logdoctor/modules/crapview/crapview.h @@ -25,6 +25,9 @@ class Crapview final : public QObject public: + explicit Crapview() noexcept {} + Q_DISABLE_COPY_MOVE(Crapview) + //! Returns the Dialogs level DialogsLevel getDialogsLevel() const noexcept; diff --git a/logdoctor/modules/crapview/modules/query.h b/logdoctor/modules/crapview/modules/query.h index 9c7bccb5..0d78e449 100644 --- a/logdoctor/modules/crapview/modules/query.h +++ b/logdoctor/modules/crapview/modules/query.h @@ -19,6 +19,9 @@ class DbQuery final public: + explicit DbQuery() noexcept {} + Q_DISABLE_COPY_MOVE(DbQuery) + // log fields enums to log fields strings const std::unordered_map FIELDS{ {LogField::Warning, FIELDS__WARNING}, diff --git a/logdoctor/modules/dialogs/boolean_dialog.h b/logdoctor/modules/dialogs/boolean_dialog.h index 36a62d4e..3ed72fbb 100644 --- a/logdoctor/modules/dialogs/boolean_dialog.h +++ b/logdoctor/modules/dialogs/boolean_dialog.h @@ -19,13 +19,13 @@ class DialogBool final : public QDialog public: - //! Dialog constructor /*! \param title The title \param text The message \param parent The parent Widget */ explicit DialogBool( const QString& title, const QString& text, QWidget *parent=nullptr ); + Q_DISABLE_COPY_MOVE(DialogBool) private slots: diff --git a/logdoctor/modules/dialogs/ida_dialog.h b/logdoctor/modules/dialogs/ida_dialog.h index 44797560..71eff544 100644 --- a/logdoctor/modules/dialogs/ida_dialog.h +++ b/logdoctor/modules/dialogs/ida_dialog.h @@ -20,7 +20,6 @@ class DialogIda final : public QDialog public: - //! Dialog constructor /*! \param title The title \param text The message @@ -30,6 +29,7 @@ public: \param parent The parent Widget */ explicit DialogIda( const QString& title, const QString& text, const bool ignore=true, const bool discard=true, const bool abort=true, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(DialogIda) private slots: diff --git a/logdoctor/modules/dialogs/message_dialog.h b/logdoctor/modules/dialogs/message_dialog.h index aedebfa4..2456949a 100644 --- a/logdoctor/modules/dialogs/message_dialog.h +++ b/logdoctor/modules/dialogs/message_dialog.h @@ -27,7 +27,6 @@ class DialogMsg final : public QDialog public: - //! Dialog constructor /*! \param title The title \param text The message @@ -35,6 +34,7 @@ public: \param parent The parent Widget */ explicit DialogMsg( const QString& title, const QString& text, const QString& additional, const MsgType type, QWidget *parent=nullptr ); + Q_DISABLE_COPY_MOVE(DialogMsg) private slots: diff --git a/logdoctor/tools/crapnote/crapnote.h b/logdoctor/tools/crapnote/crapnote.h index 660f8b58..a2e3ca7f 100644 --- a/logdoctor/tools/crapnote/crapnote.h +++ b/logdoctor/tools/crapnote/crapnote.h @@ -22,7 +22,9 @@ class Crapnote final : public QWidget Q_OBJECT public: + explicit Crapnote( const ColorsScheme colors_scheme, QFont font, QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Crapnote) //! Sets the given font void setTextFont( QFont font ) noexcept; diff --git a/logdoctor/tools/crappath/crappath.h b/logdoctor/tools/crappath/crappath.h index adfef495..37aba19b 100644 --- a/logdoctor/tools/crappath/crappath.h +++ b/logdoctor/tools/crappath/crappath.h @@ -11,6 +11,7 @@ class Crappath : public QFileDialog public: explicit Crappath( QWidget* parent=nullptr ); + Q_DISABLE_COPY_MOVE(Crappath) }; #endif // LOGDOCTOR__CRAPPATH_H