From 78fc5057ab0d100542ef91303ec705837b65da06 Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: Sat, 21 Oct 2023 10:44:07 +0800 Subject: [PATCH] misc: general cleanup --- examples/dialog/CMakeLists.txt | 26 +++++++++++++++++++ examples/dialog/dialog.h | 2 +- examples/mainwindow/CMakeLists.txt | 26 +++++++++++++++++++ examples/mainwindow/mainwindow.h | 2 +- examples/openglwidget/mainwindow.h | 2 +- examples/quick/CMakeLists.txt | 26 +++++++++++++++++++ examples/quick/quicksettings.h | 2 +- examples/widget/CMakeLists.txt | 26 +++++++++++++++++++ examples/widget/widget.h | 2 +- include/FramelessHelper/Core/chromepalette.h | 1 + .../FramelessHelper/Core/framelesshelper_qt.h | 1 + .../Core/framelesshelpercore_global.h | 2 +- .../FramelessHelper/Core/framelessmanager.h | 1 + include/FramelessHelper/Core/micamaterial.h | 1 + .../Core/private/registrykey_p.h | 5 ++-- .../Core/windowborderpainter.h | 1 + .../Quick/framelessquickhelper.h | 1 + .../framelessquickapplicationwindow_p.h | 1 + .../Quick/private/framelessquickwindow_p.h | 1 + .../FramelessHelper/Quick/quickmicamaterial.h | 1 + .../FramelessHelper/Quick/quickwindowborder.h | 1 + .../FramelessHelper/Widgets/framelessdialog.h | 1 + .../Widgets/framelessmainwindow.h | 1 + .../FramelessHelper/Widgets/framelesswidget.h | 1 + .../Widgets/framelesswidgetshelper.h | 1 + .../Widgets/standardsystembutton.h | 1 + .../Widgets/standardtitlebar.h | 1 + src/core/chromepalette.cpp | 2 +- src/core/framelesshelper_qt.cpp | 2 +- src/core/framelessmanager.cpp | 2 +- src/core/micamaterial.cpp | 2 +- src/core/registrykey.cpp | 12 ++++----- src/core/utils_linux.cpp | 8 +++--- src/core/windowborderpainter.cpp | 2 +- src/quick/framelessquickapplicationwindow.cpp | 2 +- src/quick/framelessquickhelper.cpp | 2 +- src/quick/framelessquickwindow.cpp | 2 +- src/quick/quickmicamaterial.cpp | 2 +- src/quick/quickwindowborder.cpp | 2 +- src/widgets/framelessdialog.cpp | 2 +- src/widgets/framelessmainwindow.cpp | 2 +- src/widgets/framelesswidget.cpp | 2 +- src/widgets/framelesswidgetshelper.cpp | 2 +- src/widgets/standardsystembutton.cpp | 2 +- src/widgets/standardtitlebar.cpp | 2 +- 45 files changed, 155 insertions(+), 34 deletions(-) diff --git a/examples/dialog/CMakeLists.txt b/examples/dialog/CMakeLists.txt index 269ab754..b61983d9 100644 --- a/examples/dialog/CMakeLists.txt +++ b/examples/dialog/CMakeLists.txt @@ -74,6 +74,7 @@ if(WIN32) PATH "${__manifest_path}" ID "org.wangwenx190.demo.Dialog" VERSION "${PROJECT_VERSION}" + DESCRIPTION "FramelessHelper Demo Application: Dialog" VISTA_COMPAT WIN7_COMPAT WIN8_COMPAT @@ -103,6 +104,31 @@ setup_gui_app( BUNDLE_VERSION_SHORT "1.0" ) +setup_target_rpaths(TARGETS ${DEMO_NAME}) + +setup_qt_stuff(TARGETS ${DEMO_NAME}) + +set(__extra_flags "") +if(NOT FRAMELESSHELPER_NO_PERMISSIVE_CHECKS) + list(APPEND __extra_flags PERMISSIVE) +endif() +if(FRAMELESSHELPER_ENABLE_SPECTRE) + list(APPEND __extra_flags SPECTRE) +endif() +if(FRAMELESSHELPER_ENABLE_EHCONTGUARD) + list(APPEND __extra_flags EHCONTGUARD) +endif() +if(FRAMELESSHELPER_ENABLE_INTELCET) + list(APPEND __extra_flags INTELCET) +endif() +if(FRAMELESSHELPER_ENABLE_CFGUARD) + list(APPEND __extra_flags CFGUARD) +endif() +if(FRAMELESSHELPER_FORCE_LTO) + list(APPEND __extra_flags FORCE_LTO) +endif() +setup_compile_params(TARGETS ${DEMO_NAME} ${__extra_flags}) + if(FRAMELESSHELPER_EXAMPLES_DEPLOYQT) set(__extra_flags) if(FRAMELESSHELPER_NO_INSTALL) diff --git a/examples/dialog/dialog.h b/examples/dialog/dialog.h index dd3d40d4..e06a3da6 100644 --- a/examples/dialog/dialog.h +++ b/examples/dialog/dialog.h @@ -25,7 +25,7 @@ FRAMELESSHELPER_END_NAMESPACE class Dialog : public FRAMELESSHELPER_PREPEND_NAMESPACE(FramelessDialog) { Q_OBJECT - Q_DISABLE_COPY_MOVE(Dialog) + Q_DISABLE_COPY(Dialog) public: explicit Dialog(QWidget *parent = nullptr); diff --git a/examples/mainwindow/CMakeLists.txt b/examples/mainwindow/CMakeLists.txt index ff8d68ee..065bc4cc 100644 --- a/examples/mainwindow/CMakeLists.txt +++ b/examples/mainwindow/CMakeLists.txt @@ -79,6 +79,7 @@ if(WIN32) PATH "${__manifest_path}" ID "org.wangwenx190.demo.MainWindow" VERSION "${PROJECT_VERSION}" + DESCRIPTION "FramelessHelper Demo Application: MainWindow" VISTA_COMPAT WIN7_COMPAT WIN8_COMPAT @@ -108,6 +109,31 @@ setup_gui_app( BUNDLE_VERSION_SHORT "1.0" ) +setup_target_rpaths(TARGETS ${DEMO_NAME}) + +setup_qt_stuff(TARGETS ${DEMO_NAME}) + +set(__extra_flags "") +if(NOT FRAMELESSHELPER_NO_PERMISSIVE_CHECKS) + list(APPEND __extra_flags PERMISSIVE) +endif() +if(FRAMELESSHELPER_ENABLE_SPECTRE) + list(APPEND __extra_flags SPECTRE) +endif() +if(FRAMELESSHELPER_ENABLE_EHCONTGUARD) + list(APPEND __extra_flags EHCONTGUARD) +endif() +if(FRAMELESSHELPER_ENABLE_INTELCET) + list(APPEND __extra_flags INTELCET) +endif() +if(FRAMELESSHELPER_ENABLE_CFGUARD) + list(APPEND __extra_flags CFGUARD) +endif() +if(FRAMELESSHELPER_FORCE_LTO) + list(APPEND __extra_flags FORCE_LTO) +endif() +setup_compile_params(TARGETS ${DEMO_NAME} ${__extra_flags}) + if(FRAMELESSHELPER_EXAMPLES_DEPLOYQT) set(__extra_flags) if(FRAMELESSHELPER_NO_INSTALL) diff --git a/examples/mainwindow/mainwindow.h b/examples/mainwindow/mainwindow.h index b20d98a7..ea371844 100644 --- a/examples/mainwindow/mainwindow.h +++ b/examples/mainwindow/mainwindow.h @@ -42,7 +42,7 @@ class MainWindow; class MainWindow : public FRAMELESSHELPER_PREPEND_NAMESPACE(FramelessMainWindow) { Q_OBJECT - Q_DISABLE_COPY_MOVE(MainWindow) + Q_DISABLE_COPY(MainWindow) public: explicit MainWindow(QWidget *parent = nullptr, const Qt::WindowFlags flags = {}); diff --git a/examples/openglwidget/mainwindow.h b/examples/openglwidget/mainwindow.h index b52c4e44..ff738845 100644 --- a/examples/openglwidget/mainwindow.h +++ b/examples/openglwidget/mainwindow.h @@ -35,7 +35,7 @@ class GLWidget; class MainWindow : public FRAMELESSHELPER_PREPEND_NAMESPACE(FramelessWidget) { Q_OBJECT - Q_DISABLE_COPY_MOVE(MainWindow) + Q_DISABLE_COPY(MainWindow) public: explicit MainWindow(QWidget *parent = nullptr); diff --git a/examples/quick/CMakeLists.txt b/examples/quick/CMakeLists.txt index f523e254..2474c856 100644 --- a/examples/quick/CMakeLists.txt +++ b/examples/quick/CMakeLists.txt @@ -74,6 +74,7 @@ if(WIN32) PATH "${__manifest_path}" ID "org.wangwenx190.demo.Quick" VERSION "${PROJECT_VERSION}" + DESCRIPTION "FramelessHelper Demo Application: Quick" VISTA_COMPAT WIN7_COMPAT WIN8_COMPAT @@ -135,6 +136,31 @@ setup_gui_app( BUNDLE_VERSION_SHORT "1.0" ) +setup_target_rpaths(TARGETS ${DEMO_NAME}) + +setup_qt_stuff(TARGETS ${DEMO_NAME}) + +set(__extra_flags "") +if(NOT FRAMELESSHELPER_NO_PERMISSIVE_CHECKS) + list(APPEND __extra_flags PERMISSIVE) +endif() +if(FRAMELESSHELPER_ENABLE_SPECTRE) + list(APPEND __extra_flags SPECTRE) +endif() +if(FRAMELESSHELPER_ENABLE_EHCONTGUARD) + list(APPEND __extra_flags EHCONTGUARD) +endif() +if(FRAMELESSHELPER_ENABLE_INTELCET) + list(APPEND __extra_flags INTELCET) +endif() +if(FRAMELESSHELPER_ENABLE_CFGUARD) + list(APPEND __extra_flags CFGUARD) +endif() +if(FRAMELESSHELPER_FORCE_LTO) + list(APPEND __extra_flags FORCE_LTO) +endif() +setup_compile_params(TARGETS ${DEMO_NAME} ${__extra_flags}) + if(FRAMELESSHELPER_EXAMPLES_DEPLOYQT) set(__extra_flags) if(FRAMELESSHELPER_NO_INSTALL) diff --git a/examples/quick/quicksettings.h b/examples/quick/quicksettings.h index f518eff0..0234e745 100644 --- a/examples/quick/quicksettings.h +++ b/examples/quick/quicksettings.h @@ -36,7 +36,7 @@ class QuickSettings : public QObject #ifdef QML_SINGLETON QML_SINGLETON #endif - Q_DISABLE_COPY_MOVE(QuickSettings) + Q_DISABLE_COPY(QuickSettings) public: explicit QuickSettings(QObject *parent = nullptr); diff --git a/examples/widget/CMakeLists.txt b/examples/widget/CMakeLists.txt index 17265c05..7ef70933 100644 --- a/examples/widget/CMakeLists.txt +++ b/examples/widget/CMakeLists.txt @@ -74,6 +74,7 @@ if(WIN32) PATH "${__manifest_path}" ID "org.wangwenx190.demo.Widget" VERSION "${PROJECT_VERSION}" + DESCRIPTION "FramelessHelper Demo Application: Widget" VISTA_COMPAT WIN7_COMPAT WIN8_COMPAT @@ -103,6 +104,31 @@ setup_gui_app( BUNDLE_VERSION_SHORT "1.0" ) +setup_target_rpaths(TARGETS ${DEMO_NAME}) + +setup_qt_stuff(TARGETS ${DEMO_NAME}) + +set(__extra_flags "") +if(NOT FRAMELESSHELPER_NO_PERMISSIVE_CHECKS) + list(APPEND __extra_flags PERMISSIVE) +endif() +if(FRAMELESSHELPER_ENABLE_SPECTRE) + list(APPEND __extra_flags SPECTRE) +endif() +if(FRAMELESSHELPER_ENABLE_EHCONTGUARD) + list(APPEND __extra_flags EHCONTGUARD) +endif() +if(FRAMELESSHELPER_ENABLE_INTELCET) + list(APPEND __extra_flags INTELCET) +endif() +if(FRAMELESSHELPER_ENABLE_CFGUARD) + list(APPEND __extra_flags CFGUARD) +endif() +if(FRAMELESSHELPER_FORCE_LTO) + list(APPEND __extra_flags FORCE_LTO) +endif() +setup_compile_params(TARGETS ${DEMO_NAME} ${__extra_flags}) + if(FRAMELESSHELPER_EXAMPLES_DEPLOYQT) set(__extra_flags) if(FRAMELESSHELPER_NO_INSTALL) diff --git a/examples/widget/widget.h b/examples/widget/widget.h index 8a43659d..2236fea5 100644 --- a/examples/widget/widget.h +++ b/examples/widget/widget.h @@ -42,7 +42,7 @@ FRAMELESSHELPER_END_NAMESPACE class Widget : public FRAMELESSHELPER_PREPEND_NAMESPACE(FramelessWidget) { Q_OBJECT - Q_DISABLE_COPY_MOVE(Widget) + Q_DISABLE_COPY(Widget) public: explicit Widget(QWidget *parent = nullptr); diff --git a/include/FramelessHelper/Core/chromepalette.h b/include/FramelessHelper/Core/chromepalette.h index eeb42058..ac20da87 100644 --- a/include/FramelessHelper/Core/chromepalette.h +++ b/include/FramelessHelper/Core/chromepalette.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if FRAMELESSHELPER_CONFIG(titlebar) diff --git a/include/FramelessHelper/Core/framelesshelper_qt.h b/include/FramelessHelper/Core/framelesshelper_qt.h index 93a2c06c..a8d27409 100644 --- a/include/FramelessHelper/Core/framelesshelper_qt.h +++ b/include/FramelessHelper/Core/framelesshelper_qt.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if !FRAMELESSHELPER_CONFIG(native_impl) diff --git a/include/FramelessHelper/Core/framelesshelpercore_global.h b/include/FramelessHelper/Core/framelesshelpercore_global.h index 9c7f06cf..886f030a 100644 --- a/include/FramelessHelper/Core/framelesshelpercore_global.h +++ b/include/FramelessHelper/Core/framelesshelpercore_global.h @@ -268,7 +268,7 @@ QT_END_NAMESPACE # define FRAMELESSHELPER_CLASS_DPTR(Class) \ private: \ Q_DECLARE_PRIVATE(Class) \ - const QScopedPointer d_ptr; + const std::unique_ptr d_ptr; #endif #ifndef FRAMELESSHELPER_CLASS_QPTR diff --git a/include/FramelessHelper/Core/framelessmanager.h b/include/FramelessHelper/Core/framelessmanager.h index 75ae3d55..a254a423 100644 --- a/include/FramelessHelper/Core/framelessmanager.h +++ b/include/FramelessHelper/Core/framelessmanager.h @@ -25,6 +25,7 @@ #pragma once #include +#include FRAMELESSHELPER_BEGIN_NAMESPACE diff --git a/include/FramelessHelper/Core/micamaterial.h b/include/FramelessHelper/Core/micamaterial.h index 19939a4d..5d244931 100644 --- a/include/FramelessHelper/Core/micamaterial.h +++ b/include/FramelessHelper/Core/micamaterial.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if FRAMELESSHELPER_CONFIG(mica_material) diff --git a/include/FramelessHelper/Core/private/registrykey_p.h b/include/FramelessHelper/Core/private/registrykey_p.h index 2ceca109..8290bacf 100644 --- a/include/FramelessHelper/Core/private/registrykey_p.h +++ b/include/FramelessHelper/Core/private/registrykey_p.h @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef Q_OS_WINDOWS @@ -86,9 +87,9 @@ class FRAMELESSHELPER_CORE_API RegistryKey : public QObject Global::RegistryRootKey m_rootKey = Global::RegistryRootKey::CurrentUser; QString m_subKey = {}; #if REGISTRYKEY_QWINREGISTRYKEY - QScopedPointer m_registryKey; + std::unique_ptr m_registryKey; #else - QScopedPointer m_settings; + std::unique_ptr m_settings; #endif }; diff --git a/include/FramelessHelper/Core/windowborderpainter.h b/include/FramelessHelper/Core/windowborderpainter.h index 084002a8..62eb0493 100644 --- a/include/FramelessHelper/Core/windowborderpainter.h +++ b/include/FramelessHelper/Core/windowborderpainter.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if FRAMELESSHELPER_CONFIG(border_painter) diff --git a/include/FramelessHelper/Quick/framelessquickhelper.h b/include/FramelessHelper/Quick/framelessquickhelper.h index 09bf85e2..77a2dcef 100644 --- a/include/FramelessHelper/Quick/framelessquickhelper.h +++ b/include/FramelessHelper/Quick/framelessquickhelper.h @@ -27,6 +27,7 @@ #include #include #include +#include FRAMELESSHELPER_BEGIN_NAMESPACE diff --git a/include/FramelessHelper/Quick/private/framelessquickapplicationwindow_p.h b/include/FramelessHelper/Quick/private/framelessquickapplicationwindow_p.h index f5b2f749..bb8499b3 100644 --- a/include/FramelessHelper/Quick/private/framelessquickapplicationwindow_p.h +++ b/include/FramelessHelper/Quick/private/framelessquickapplicationwindow_p.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))) diff --git a/include/FramelessHelper/Quick/private/framelessquickwindow_p.h b/include/FramelessHelper/Quick/private/framelessquickwindow_p.h index 40afd29e..9052cd0e 100644 --- a/include/FramelessHelper/Quick/private/framelessquickwindow_p.h +++ b/include/FramelessHelper/Quick/private/framelessquickwindow_p.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window)) diff --git a/include/FramelessHelper/Quick/quickmicamaterial.h b/include/FramelessHelper/Quick/quickmicamaterial.h index e1c1431a..69abe6ef 100644 --- a/include/FramelessHelper/Quick/quickmicamaterial.h +++ b/include/FramelessHelper/Quick/quickmicamaterial.h @@ -26,6 +26,7 @@ #include #include +#include #if FRAMELESSHELPER_CONFIG(mica_material) diff --git a/include/FramelessHelper/Quick/quickwindowborder.h b/include/FramelessHelper/Quick/quickwindowborder.h index c34a9dbc..d3a61460 100644 --- a/include/FramelessHelper/Quick/quickwindowborder.h +++ b/include/FramelessHelper/Quick/quickwindowborder.h @@ -26,6 +26,7 @@ #include #include +#include #if FRAMELESSHELPER_CONFIG(border_painter) diff --git a/include/FramelessHelper/Widgets/framelessdialog.h b/include/FramelessHelper/Widgets/framelessdialog.h index e09260ee..1060969a 100644 --- a/include/FramelessHelper/Widgets/framelessdialog.h +++ b/include/FramelessHelper/Widgets/framelessdialog.h @@ -26,6 +26,7 @@ #include #include +#include #if FRAMELESSHELPER_CONFIG(window) diff --git a/include/FramelessHelper/Widgets/framelessmainwindow.h b/include/FramelessHelper/Widgets/framelessmainwindow.h index edb7aa20..36913405 100644 --- a/include/FramelessHelper/Widgets/framelessmainwindow.h +++ b/include/FramelessHelper/Widgets/framelessmainwindow.h @@ -26,6 +26,7 @@ #include #include +#include #if FRAMELESSHELPER_CONFIG(window) diff --git a/include/FramelessHelper/Widgets/framelesswidget.h b/include/FramelessHelper/Widgets/framelesswidget.h index 56f6c7fa..cc55c165 100644 --- a/include/FramelessHelper/Widgets/framelesswidget.h +++ b/include/FramelessHelper/Widgets/framelesswidget.h @@ -26,6 +26,7 @@ #include #include +#include #if FRAMELESSHELPER_CONFIG(window) diff --git a/include/FramelessHelper/Widgets/framelesswidgetshelper.h b/include/FramelessHelper/Widgets/framelesswidgetshelper.h index 4d8a95ba..16f68cd8 100644 --- a/include/FramelessHelper/Widgets/framelesswidgetshelper.h +++ b/include/FramelessHelper/Widgets/framelesswidgetshelper.h @@ -26,6 +26,7 @@ #include #include +#include FRAMELESSHELPER_BEGIN_NAMESPACE diff --git a/include/FramelessHelper/Widgets/standardsystembutton.h b/include/FramelessHelper/Widgets/standardsystembutton.h index 7b8b7282..e8cc8cbb 100644 --- a/include/FramelessHelper/Widgets/standardsystembutton.h +++ b/include/FramelessHelper/Widgets/standardsystembutton.h @@ -26,6 +26,7 @@ #include #include +#include #if FRAMELESSHELPER_CONFIG(system_button) diff --git a/include/FramelessHelper/Widgets/standardtitlebar.h b/include/FramelessHelper/Widgets/standardtitlebar.h index 1e8f77b3..050e6e37 100644 --- a/include/FramelessHelper/Widgets/standardtitlebar.h +++ b/include/FramelessHelper/Widgets/standardtitlebar.h @@ -25,6 +25,7 @@ #pragma once #include +#include #if FRAMELESSHELPER_CONFIG(titlebar) diff --git a/src/core/chromepalette.cpp b/src/core/chromepalette.cpp index bd191c94..3fb5f490 100644 --- a/src/core/chromepalette.cpp +++ b/src/core/chromepalette.cpp @@ -133,7 +133,7 @@ void ChromePalettePrivate::refresh() } ChromePalette::ChromePalette(QObject *parent) : - QObject(parent), d_ptr(new ChromePalettePrivate(this)) + QObject(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/core/framelesshelper_qt.cpp b/src/core/framelesshelper_qt.cpp index 25a0e1d9..2e6f2b59 100644 --- a/src/core/framelesshelper_qt.cpp +++ b/src/core/framelesshelper_qt.cpp @@ -103,7 +103,7 @@ FramelessHelperQtPrivate::FramelessHelperQtPrivate(FramelessHelperQt *q) : q_ptr FramelessHelperQtPrivate::~FramelessHelperQtPrivate() = default; -FramelessHelperQt::FramelessHelperQt(QObject *parent) : QObject(parent), d_ptr(new FramelessHelperQtPrivate(this)) +FramelessHelperQt::FramelessHelperQt(QObject *parent) : QObject(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/core/framelessmanager.cpp b/src/core/framelessmanager.cpp index 4c33132d..64bd9fad 100644 --- a/src/core/framelessmanager.cpp +++ b/src/core/framelessmanager.cpp @@ -428,7 +428,7 @@ void FramelessManagerPrivate::initialize() } FramelessManager::FramelessManager(QObject *parent) : - QObject(parent), d_ptr(new FramelessManagerPrivate(this)) + QObject(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/core/micamaterial.cpp b/src/core/micamaterial.cpp index 558aeec2..5dc5db61 100644 --- a/src/core/micamaterial.cpp +++ b/src/core/micamaterial.cpp @@ -830,7 +830,7 @@ QRect MicaMaterialPrivate::mapToWallpaper(const QRect &rect) const } MicaMaterial::MicaMaterial(QObject *parent) - : QObject(parent), d_ptr(new MicaMaterialPrivate(this)) + : QObject(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/core/registrykey.cpp b/src/core/registrykey.cpp index 92f873cd..1dd283eb 100644 --- a/src/core/registrykey.cpp +++ b/src/core/registrykey.cpp @@ -66,7 +66,7 @@ static constexpr const std::array g_registryKeyMap = 0x80000060 // HKEY_PERFORMANCE_NLSTEXT }; static constexpr const auto registryKeyCount = std::size(g_registryKeyMap); -static_assert(registryKeyCount == (static_cast(RegistryRootKey::PerformanceNlsText) + 1)); +static_assert(registryKeyCount == (static_cast(RegistryRootKey::PerformanceNlsText) + 1)); [[maybe_unused]] static Q_STRING_CONSTEXPR const std::array g_registryStrMap = { @@ -91,14 +91,14 @@ RegistryKey::RegistryKey(const RegistryRootKey root, const QString &key, QObject m_rootKey = root; m_subKey = key; #if REGISTRYKEY_QWINREGISTRYKEY - m_registryKey.reset(new QWinRegistryKey(reinterpret_cast(g_registryKeyMap.at(static_cast(m_rootKey))), m_subKey)); + m_registryKey = std::make_unique(reinterpret_cast(g_registryKeyMap.at(static_cast(m_rootKey))), m_subKey); if (!m_registryKey->isValid()) { m_registryKey.reset(); } #else - const QString rootKey = g_registryStrMap.at(static_cast(m_rootKey)); + const QString rootKey = g_registryStrMap.at(static_cast(m_rootKey)); const auto lastSlashPos = m_subKey.lastIndexOf(u'\\'); - m_settings.reset(new QSettings(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat)); + m_settings = std::make_unique(rootKey + u'\\' + m_subKey.left(lastSlashPos), QSettings::NativeFormat); if (m_settings->childGroups().contains(m_subKey.mid(lastSlashPos + 1))) { m_settings.reset(new QSettings(rootKey + u'\\' + m_subKey, QSettings::NativeFormat)); } else { @@ -122,9 +122,9 @@ QString RegistryKey::subKey() const bool RegistryKey::isValid() const { #if REGISTRYKEY_QWINREGISTRYKEY - return (!m_registryKey.isNull() && m_registryKey->isValid()); + return (m_registryKey && m_registryKey->isValid()); #else - return !m_settings.isNull(); + return m_settings; #endif } diff --git a/src/core/utils_linux.cpp b/src/core/utils_linux.cpp index a3ec94a1..c7c941eb 100644 --- a/src/core/utils_linux.cpp +++ b/src/core/utils_linux.cpp @@ -530,13 +530,13 @@ WallpaperAspectStyle Utils::getWallpaperAspectStyle() if (options.isEmpty()) { return defaultAspectStyle; } else { - if ((options == u"wallpaper"_s) || (options == u"tiled"_s)) { + if ((options == "wallpaper"_L1) || (options == "tiled"_L1)) { return WallpaperAspectStyle::Tile; - } else if (options == u"centered"_s) { + } else if (options == "centered"_L1) { return WallpaperAspectStyle::Center; - } else if (options == u"stretched"_s) { + } else if (options == "stretched"_L1) { return WallpaperAspectStyle::Stretch; - } else if (options == u"scaled"_s) { + } else if (options == "scaled"_L1) { return WallpaperAspectStyle::Fit; } else { return defaultAspectStyle; diff --git a/src/core/windowborderpainter.cpp b/src/core/windowborderpainter.cpp index 255471b2..205ad37a 100644 --- a/src/core/windowborderpainter.cpp +++ b/src/core/windowborderpainter.cpp @@ -84,7 +84,7 @@ const WindowBorderPainterPrivate *WindowBorderPainterPrivate::get(const WindowBo } WindowBorderPainter::WindowBorderPainter(QObject *parent) - : QObject(parent), d_ptr(new WindowBorderPainterPrivate(this)) + : QObject(parent), d_ptr(std::make_unique(this)) { connect(FramelessManager::instance(), &FramelessManager::systemThemeChanged, this, &WindowBorderPainter::nativeBorderChanged); connect(this, &WindowBorderPainter::nativeBorderChanged, this, &WindowBorderPainter::shouldRepaint); diff --git a/src/quick/framelessquickapplicationwindow.cpp b/src/quick/framelessquickapplicationwindow.cpp index 1e06e559..0c151893 100644 --- a/src/quick/framelessquickapplicationwindow.cpp +++ b/src/quick/framelessquickapplicationwindow.cpp @@ -84,7 +84,7 @@ const FramelessQuickApplicationWindowPrivate *FramelessQuickApplicationWindowPri } FramelessQuickApplicationWindow::FramelessQuickApplicationWindow(QWindow *parent) - : QQuickApplicationWindow(parent), d_ptr(new FramelessQuickApplicationWindowPrivate(this)) + : QQuickApplicationWindow(parent), d_ptr(std::make_unique(this)) { QQuickItem * const rootItem = contentItem(); FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar(); diff --git a/src/quick/framelessquickhelper.cpp b/src/quick/framelessquickhelper.cpp index c91a3aa3..1649ccf4 100644 --- a/src/quick/framelessquickhelper.cpp +++ b/src/quick/framelessquickhelper.cpp @@ -641,7 +641,7 @@ void FramelessQuickHelperPrivate::rebindWindow() } FramelessQuickHelper::FramelessQuickHelper(QQuickItem *parent) - : QQuickItem(parent), d_ptr(new FramelessQuickHelperPrivate(this)) + : QQuickItem(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/quick/framelessquickwindow.cpp b/src/quick/framelessquickwindow.cpp index 58f22fe3..05855ed2 100644 --- a/src/quick/framelessquickwindow.cpp +++ b/src/quick/framelessquickwindow.cpp @@ -84,7 +84,7 @@ const FramelessQuickWindowPrivate *FramelessQuickWindowPrivate::get(const Framel } FramelessQuickWindow::FramelessQuickWindow(QWindow *parent) - : QQuickWindowQmlImpl(parent), d_ptr(new FramelessQuickWindowPrivate(this)) + : QQuickWindowQmlImpl(parent), d_ptr(std::make_unique(this)) { QQuickItem * const rootItem = contentItem(); FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar(); diff --git a/src/quick/quickmicamaterial.cpp b/src/quick/quickmicamaterial.cpp index eb806cb9..674ff95a 100644 --- a/src/quick/quickmicamaterial.cpp +++ b/src/quick/quickmicamaterial.cpp @@ -145,7 +145,7 @@ void QuickMicaMaterialPrivate::rebindWindow() } QuickMicaMaterial::QuickMicaMaterial(QQuickItem *parent) - : QQuickPaintedItem(parent), d_ptr(new QuickMicaMaterialPrivate(this)) + : QQuickPaintedItem(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/quick/quickwindowborder.cpp b/src/quick/quickwindowborder.cpp index 828336d3..2562c407 100644 --- a/src/quick/quickwindowborder.cpp +++ b/src/quick/quickwindowborder.cpp @@ -180,7 +180,7 @@ void QuickWindowBorderPrivate::rebindWindow() } QuickWindowBorder::QuickWindowBorder(QQuickItem *parent) - : QQuickPaintedItem(parent), d_ptr(new QuickWindowBorderPrivate(this)) + : QQuickPaintedItem(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/widgets/framelessdialog.cpp b/src/widgets/framelessdialog.cpp index c36d591e..21ddd57d 100644 --- a/src/widgets/framelessdialog.cpp +++ b/src/widgets/framelessdialog.cpp @@ -78,7 +78,7 @@ const FramelessDialogPrivate *FramelessDialogPrivate::get(const FramelessDialog } FramelessDialog::FramelessDialog(QWidget *parent) - : QDialog(parent), d_ptr(new FramelessDialogPrivate(this)) + : QDialog(parent), d_ptr(std::make_unique(this)) { FramelessWidgetsHelper::get(this)->extendsContentIntoTitleBar(); Q_D(FramelessDialog); diff --git a/src/widgets/framelessmainwindow.cpp b/src/widgets/framelessmainwindow.cpp index de415f73..67725e4e 100644 --- a/src/widgets/framelessmainwindow.cpp +++ b/src/widgets/framelessmainwindow.cpp @@ -79,7 +79,7 @@ const FramelessMainWindowPrivate *FramelessMainWindowPrivate::get(const Frameles } FramelessMainWindow::FramelessMainWindow(QWidget *parent, const Qt::WindowFlags flags) - : QMainWindow(parent, flags), d_ptr(new FramelessMainWindowPrivate(this)) + : QMainWindow(parent, flags), d_ptr(std::make_unique(this)) { FramelessWidgetsHelper::get(this)->extendsContentIntoTitleBar(); Q_D(FramelessMainWindow); diff --git a/src/widgets/framelesswidget.cpp b/src/widgets/framelesswidget.cpp index 296d1b95..b5732f96 100644 --- a/src/widgets/framelesswidget.cpp +++ b/src/widgets/framelesswidget.cpp @@ -79,7 +79,7 @@ const FramelessWidgetPrivate *FramelessWidgetPrivate::get(const FramelessWidget } FramelessWidget::FramelessWidget(QWidget *parent) - : QWidget(parent, Qt::Window), d_ptr(new FramelessWidgetPrivate(this)) + : QWidget(parent, Qt::Window), d_ptr(std::make_unique(this)) { FramelessWidgetsHelper::get(this)->extendsContentIntoTitleBar(); Q_D(FramelessWidget); diff --git a/src/widgets/framelesswidgetshelper.cpp b/src/widgets/framelesswidgetshelper.cpp index 6362b4a4..2fc44281 100644 --- a/src/widgets/framelesswidgetshelper.cpp +++ b/src/widgets/framelesswidgetshelper.cpp @@ -779,7 +779,7 @@ void FramelessWidgetsHelper::setSystemButton(QWidget *widget, const SystemButton } FramelessWidgetsHelper::FramelessWidgetsHelper(QObject *parent) - : QObject(parent), d_ptr(new FramelessWidgetsHelperPrivate(this)) + : QObject(parent), d_ptr(std::make_unique(this)) { } diff --git a/src/widgets/standardsystembutton.cpp b/src/widgets/standardsystembutton.cpp index d6538697..73e8205f 100644 --- a/src/widgets/standardsystembutton.cpp +++ b/src/widgets/standardsystembutton.cpp @@ -86,7 +86,7 @@ QSize StandardSystemButtonPrivate::getRecommendedButtonSize() } StandardSystemButton::StandardSystemButton(QWidget *parent) - : QPushButton(parent), d_ptr(new StandardSystemButtonPrivate(this)) + : QPushButton(parent), d_ptr(std::make_unique(this)) { FramelessManagerPrivate::initializeIconFont(); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); diff --git a/src/widgets/standardtitlebar.cpp b/src/widgets/standardtitlebar.cpp index f7871cf9..398e5bbd 100644 --- a/src/widgets/standardtitlebar.cpp +++ b/src/widgets/standardtitlebar.cpp @@ -449,7 +449,7 @@ void StandardTitleBarPrivate::initialize() } StandardTitleBar::StandardTitleBar(QWidget *parent) - : QWidget(parent), d_ptr(new StandardTitleBarPrivate(this)) + : QWidget(parent), d_ptr(std::make_unique(this)) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setFixedHeight(kDefaultTitleBarHeight);