From 5fb51c3e91ce8ba5cba5f488f13093be957c4276 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 7 May 2024 11:20:12 +0300 Subject: [PATCH] Refactoring. --- src/libs/ifc/exception/vexception.h | 9 ++++++--- src/libs/ifc/exception/vexceptionundo.h | 14 ++++++++------ src/libs/vmisc/vabstractapplication.cpp | 7 ++----- src/libs/vmisc/vabstractapplication.h | 2 ++ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/libs/ifc/exception/vexception.h b/src/libs/ifc/exception/vexception.h index dcedf8655..1148d9e9f 100644 --- a/src/libs/ifc/exception/vexception.h +++ b/src/libs/ifc/exception/vexception.h @@ -50,12 +50,15 @@ public: explicit VException(const QString &error) V_NOEXCEPT_EXPR(true); VException(const VException &e) V_NOEXCEPT_EXPR(true); auto operator=(const VException &e) V_NOEXCEPT_EXPR(true) -> VException &; - virtual ~VException() V_NOEXCEPT_EXPR(true) = default; + ~VException() V_NOEXCEPT_EXPR(true) override = default; - Q_NORETURN virtual void raise() const override; + VException(VException &&) noexcept = default; + auto operator=(VException &&) noexcept -> VException & = default; + + Q_NORETURN void raise() const override; // cppcheck-suppress unusedFunction - Q_REQUIRED_RESULT virtual auto clone() const -> VException * override; + Q_REQUIRED_RESULT auto clone() const -> VException * override; virtual auto ErrorMessage() const -> QString; virtual auto DetailedInformation() const -> QString; diff --git a/src/libs/ifc/exception/vexceptionundo.h b/src/libs/ifc/exception/vexceptionundo.h index 955e6940c..0fcbb44d8 100644 --- a/src/libs/ifc/exception/vexceptionundo.h +++ b/src/libs/ifc/exception/vexceptionundo.h @@ -29,7 +29,6 @@ #ifndef VEXCEPTIONUNDO_H #define VEXCEPTIONUNDO_H - #include #include "../ifcdef.h" @@ -38,13 +37,16 @@ class VExceptionUndo : public VException { public: - explicit VExceptionUndo(const QString &what) V_NOEXCEPT_EXPR (true); - VExceptionUndo(const VExceptionUndo &e) V_NOEXCEPT_EXPR (true); - virtual ~VExceptionUndo() V_NOEXCEPT_EXPR (true) = default; + explicit VExceptionUndo(const QString &what) V_NOEXCEPT_EXPR(true); + VExceptionUndo(const VExceptionUndo &e) V_NOEXCEPT_EXPR(true); + ~VExceptionUndo() V_NOEXCEPT_EXPR(true) override = default; - Q_NORETURN virtual void raise() const override { throw *this; } + VExceptionUndo(VExceptionUndo &&) noexcept = default; + auto operator=(VExceptionUndo &&) noexcept -> VExceptionUndo & = default; - Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionUndo * override { return new VExceptionUndo(*this); } + Q_NORETURN void raise() const override { throw *this; } + + Q_REQUIRED_RESULT auto clone() const -> VExceptionUndo * override { return new VExceptionUndo(*this); } }; #endif // VEXCEPTIONUNDO_H diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 1e11a4069..c5fc29988 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -609,6 +609,7 @@ void VAbstractApplication::RepopulateFontDatabase(const QString &path) } } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) //--------------------------------------------------------------------------------------------------------------------- // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays) auto VAbstractApplication::IsOptionSet(int argc, char *argv[], const char *option) -> bool @@ -628,7 +629,6 @@ auto VAbstractApplication::IsOptionSet(int argc, char *argv[], const char *optio // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays) void VAbstractApplication::InitHighDpiScaling(int argc, char *argv[]) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) /* For more info see: http://doc.qt.io/qt-5/highdpi.html */ if (IsOptionSet(argc, argv, qPrintable("--"_L1 + LONG_OPTION_NO_HDPI_SCALING))) { @@ -638,11 +638,8 @@ void VAbstractApplication::InitHighDpiScaling(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support } -#else - Q_UNUSED(argc); - Q_UNUSED(argv); -#endif } +#endif //--------------------------------------------------------------------------------------------------------------------- auto VAbstractApplication::LogDirPath() -> QString diff --git a/src/libs/vmisc/vabstractapplication.h b/src/libs/vmisc/vabstractapplication.h index 189f4f63c..7afb03222 100644 --- a/src/libs/vmisc/vabstractapplication.h +++ b/src/libs/vmisc/vabstractapplication.h @@ -120,10 +120,12 @@ public: auto GetPlaceholderTranslator() -> QSharedPointer; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays) static auto IsOptionSet(int argc, char *argv[], const char *option) -> bool; // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays) static void InitHighDpiScaling(int argc, char *argv[]); +#endif static auto LogDirPath() -> QString; static auto CreateLogDir() -> bool;