diff --git a/example/src/component/CircularReveal.h b/example/src/component/CircularReveal.h index 03101678..7f719851 100644 --- a/example/src/component/CircularReveal.h +++ b/example/src/component/CircularReveal.h @@ -15,7 +15,7 @@ Q_PROPERTY_AUTO(int, radius) void paint(QPainter *painter) override; - Q_INVOKABLE [[maybe_unused]] void start(int w, int h, const QPoint ¢er, int radius); + [[maybe_unused]] Q_INVOKABLE void start(int w, int h, const QPoint ¢er, int radius); Q_SIGNAL void imageChanged(); diff --git a/example/src/helper/InitializrHelper.h b/example/src/helper/InitializrHelper.h index 3f3ba910..f1a68f96 100644 --- a/example/src/helper/InitializrHelper.h +++ b/example/src/helper/InitializrHelper.h @@ -22,7 +22,7 @@ SINGLETON(InitializrHelper) ~InitializrHelper() override; - Q_INVOKABLE [[maybe_unused]] void generate(const QString &name, const QString &path); + [[maybe_unused]] Q_INVOKABLE void generate(const QString &name, const QString &path); Q_SIGNAL void error(const QString &message); diff --git a/src/FluAccentColor.cpp b/src/FluAccentColor.cpp index 0d789f00..cc900682 100644 --- a/src/FluAccentColor.cpp +++ b/src/FluAccentColor.cpp @@ -1,5 +1,4 @@ #include "FluAccentColor.h" FluAccentColor::FluAccentColor(QObject *parent) : QObject{parent} { - } diff --git a/src/FluColors.cpp b/src/FluColors.cpp index 10cbe472..4f938326 100644 --- a/src/FluColors.cpp +++ b/src/FluColors.cpp @@ -109,7 +109,7 @@ FluColors::FluColors(QObject *parent) : QObject{parent} { _Green = green; } -[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(const QColor& primaryColor) { +[[maybe_unused]] FluAccentColor *FluColors::createAccentColor(const QColor &primaryColor) { auto accentColor = new FluAccentColor(this); accentColor->normal(primaryColor); accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor, 0.9)); diff --git a/src/FluColors.h b/src/FluColors.h index 16452654..55efac31 100644 --- a/src/FluColors.h +++ b/src/FluColors.h @@ -55,7 +55,7 @@ Q_PROPERTY_AUTO_P(FluAccentColor*, Green); public: SINGLETON(FluColors) - [[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(const QColor& primaryColor); + [[maybe_unused]] Q_INVOKABLE FluAccentColor *createAccentColor(const QColor &primaryColor); static FluColors *create(QQmlEngine *, QJSEngine *) { return getInstance(); } }; diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index e7737804..7ae11159 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -112,7 +112,7 @@ void FluFrameless::componentComplete() { ::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); }); #endif - h = h + _appbar->height(); + h = qRound(h + _appbar->height()); if (_fixSize) { window()->setMaximumSize(QSize(w, h)); window()->setMinimumSize(QSize(w, h)); @@ -146,7 +146,7 @@ void FluFrameless::componentComplete() { auto *wp = reinterpret_cast(lParam); if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) { wp->flags |= SWP_NOCOPYBITS; - *result = ::DefWindowProcW(hwnd, uMsg, wParam, lParam); + *result = static_cast(::DefWindowProcW(hwnd, uMsg, wParam, lParam)); return true; } return false; @@ -158,7 +158,7 @@ void FluFrameless::componentComplete() { const LONG originalBottom = clientRect->bottom; const LRESULT hitTestResult = ::DefWindowProcW(hwnd, WM_NCCALCSIZE, wParam, lParam); if ((hitTestResult != HTERROR) && (hitTestResult != HTNOWHERE)) { - *result = hitTestResult; + *result = static_cast(hitTestResult); return true; } int offsetSize; @@ -175,12 +175,19 @@ void FluFrameless::componentComplete() { if (!isCompositionEnabled()) { offsetSize = 0; } - if (!isMaximum || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + clientRect->top = originalTop + offsetSize; + clientRect->bottom = originalBottom - offsetSize; + clientRect->left = originalLeft + offsetSize; + clientRect->right = originalRight - offsetSize; +#else + if (!isMaximum) { clientRect->top = originalTop + offsetSize; clientRect->bottom = originalBottom - offsetSize; clientRect->left = originalLeft + offsetSize; clientRect->right = originalRight - offsetSize; } +#endif _setMaximizeHovered(false); *result = WVR_REDRAW; return true; @@ -255,7 +262,7 @@ void FluFrameless::componentComplete() { *result = FALSE; return true; } else if (uMsg == WM_NCACTIVATE) { - *result = ::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1); + *result = static_cast(::DefWindowProcW(hwnd, WM_NCACTIVATE, wParam, -1)); return true; } else if (uMsg == WM_GETMINMAXINFO) { auto *minmaxInfo = reinterpret_cast(lParam); @@ -270,9 +277,9 @@ void FluFrameless::componentComplete() { auto geometry = window()->screen()->availableGeometry(); RECT rect; SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); - if(!_fixSize){ - minmaxInfo->ptMinTrackSize.x = window()->minimumWidth() * pixelRatio + offsetXY.x(); - minmaxInfo->ptMinTrackSize.y = window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio; + if (!_fixSize) { + minmaxInfo->ptMinTrackSize.x = qRound(window()->minimumWidth() * pixelRatio + offsetXY.x()); + minmaxInfo->ptMinTrackSize.y = qRound(window()->minimumHeight() * pixelRatio + offsetXY.y() + _appbar->height() * pixelRatio); } minmaxInfo->ptMaxPosition.x = rect.left - offsetXY.x(); minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); @@ -294,11 +301,11 @@ void FluFrameless::componentComplete() { } else if (uMsg == WM_SYSCOMMAND) { if (wParam == SC_MINIMIZE) { if (window()->transientParent()) { - HWND hwnd = reinterpret_cast(window()->transientParent()->winId()); - ::ShowWindow(hwnd, 2); + auto _hwnd = reinterpret_cast(window()->transientParent()->winId()); + ::ShowWindow(_hwnd, 2); } else { - HWND hwnd = reinterpret_cast(window()->winId()); - ::ShowWindow(hwnd, 2); + auto _hwnd = reinterpret_cast(window()->winId()); + ::ShowWindow(_hwnd, 2); } return true; } diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 3949aab2..31be64e6 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -29,10 +29,10 @@ FluTheme::FluTheme(QObject *parent) : QObject{parent} { }); connect(this, &FluTheme::darkChanged, this, [=] { refreshColors(); }); connect(this, &FluTheme::accentColorChanged, this, [=] { refreshColors(); }); - connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){ + connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path) { Q_EMIT desktopImagePathChanged(); }); - connect(this, &FluTheme::blurBehindWindowEnabledChanged, this, [=] {checkUpdateDesktopImage();}); + connect(this, &FluTheme::blurBehindWindowEnabledChanged, this, [=] { checkUpdateDesktopImage(); }); startTimer(1000); } @@ -74,15 +74,15 @@ bool FluTheme::dark() const { } } -void FluTheme::checkUpdateDesktopImage(){ - if(!_blurBehindWindowEnabled){ +void FluTheme::checkUpdateDesktopImage() { + if (!_blurBehindWindowEnabled) { return; } QThreadPool::globalInstance()->start([=]() { _mutex.lock(); auto path = FluTools::getInstance()->getWallpaperFilePath(); - if(_desktopImagePath != path){ - if(!_desktopImagePath.isEmpty()){ + if (_desktopImagePath != path) { + if (!_desktopImagePath.isEmpty()) { _watcher.removePath(_desktopImagePath); } desktopImagePath(path); @@ -92,7 +92,6 @@ void FluTheme::checkUpdateDesktopImage(){ }); } -void FluTheme::timerEvent(QTimerEvent *event) -{ +void FluTheme::timerEvent(QTimerEvent *event) { checkUpdateDesktopImage(); } diff --git a/src/FluTheme.h b/src/FluTheme.h index b26cdb6c..3fa1c52e 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -1,5 +1,4 @@ -#ifndef FLUTHEME_H -#define FLUTHEME_H +#pragma once #include #include @@ -18,7 +17,7 @@ */ class FluTheme : public QObject { Q_OBJECT -Q_PROPERTY(bool dark READ dark NOTIFY darkChanged) + Q_PROPERTY(bool dark READ dark NOTIFY darkChanged) Q_PROPERTY_AUTO_P(FluAccentColor*, accentColor); Q_PROPERTY_AUTO(QColor, primaryColor); Q_PROPERTY_AUTO(QColor, backgroundColor); @@ -49,8 +48,6 @@ Q_PROPERTY_AUTO(bool, blurBehindWindowEnabled); void refreshColors(); - void updateBackgroundMainColor(); - protected: void timerEvent(QTimerEvent *event) override; @@ -70,6 +67,4 @@ SINGLETON(FluTheme) bool _systemDark; QFileSystemWatcher _watcher; QMutex _mutex; -}; - -#endif // FLUTHEME_H +}; \ No newline at end of file