Refactoring.

This commit is contained in:
Roman Telezhynskyi 2024-05-07 11:20:12 +03:00
parent 8451ff874a
commit 5fb51c3e91
4 changed files with 18 additions and 14 deletions

View File

@ -50,12 +50,15 @@ public:
explicit VException(const QString &error) V_NOEXCEPT_EXPR(true); explicit VException(const QString &error) V_NOEXCEPT_EXPR(true);
VException(const VException &e) V_NOEXCEPT_EXPR(true); VException(const VException &e) V_NOEXCEPT_EXPR(true);
auto operator=(const VException &e) V_NOEXCEPT_EXPR(true) -> VException &; 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 // 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 ErrorMessage() const -> QString;
virtual auto DetailedInformation() const -> QString; virtual auto DetailedInformation() const -> QString;

View File

@ -29,7 +29,6 @@
#ifndef VEXCEPTIONUNDO_H #ifndef VEXCEPTIONUNDO_H
#define VEXCEPTIONUNDO_H #define VEXCEPTIONUNDO_H
#include <QString> #include <QString>
#include "../ifcdef.h" #include "../ifcdef.h"
@ -40,11 +39,14 @@ class VExceptionUndo : public VException
public: public:
explicit VExceptionUndo(const QString &what) V_NOEXCEPT_EXPR(true); explicit VExceptionUndo(const QString &what) V_NOEXCEPT_EXPR(true);
VExceptionUndo(const VExceptionUndo &e) V_NOEXCEPT_EXPR(true); VExceptionUndo(const VExceptionUndo &e) V_NOEXCEPT_EXPR(true);
virtual ~VExceptionUndo() V_NOEXCEPT_EXPR (true) = default; ~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 #endif // VEXCEPTIONUNDO_H

View File

@ -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) // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays)
auto VAbstractApplication::IsOptionSet(int argc, char *argv[], const char *option) -> bool 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) // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays)
void VAbstractApplication::InitHighDpiScaling(int argc, char *argv[]) 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 */ /* For more info see: http://doc.qt.io/qt-5/highdpi.html */
if (IsOptionSet(argc, argv, qPrintable("--"_L1 + LONG_OPTION_NO_HDPI_SCALING))) 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 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
} }
#else
Q_UNUSED(argc);
Q_UNUSED(argv);
#endif
} }
#endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractApplication::LogDirPath() -> QString auto VAbstractApplication::LogDirPath() -> QString

View File

@ -120,10 +120,12 @@ public:
auto GetPlaceholderTranslator() -> QSharedPointer<VTranslator>; auto GetPlaceholderTranslator() -> QSharedPointer<VTranslator>;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays) // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays)
static auto IsOptionSet(int argc, char *argv[], const char *option) -> bool; static auto IsOptionSet(int argc, char *argv[], const char *option) -> bool;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays) // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, hicpp-avoid-c-arrays, modernize-avoid-c-arrays)
static void InitHighDpiScaling(int argc, char *argv[]); static void InitHighDpiScaling(int argc, char *argv[]);
#endif
static auto LogDirPath() -> QString; static auto LogDirPath() -> QString;
static auto CreateLogDir() -> bool; static auto CreateLogDir() -> bool;