File indexing completed on 2024-07-14 14:29:46

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Piyush Aggarwal <piyushaggarwal002@gmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KCOLORSCHEMEWATCHER_WIN_H
0008 #define KCOLORSCHEMEWATCHER_WIN_H
0009 
0010 #include <QAbstractNativeEventFilter>
0011 #include <QSettings>
0012 
0013 #include "kcolorschemewatcherbackend.h"
0014 
0015 class KColorSchemeWatcherWin : public KColorSchemeWatcherBackend, public QAbstractNativeEventFilter
0016 {
0017     Q_OBJECT
0018 public:
0019     KColorSchemeWatcherWin();
0020     KColorSchemeWatcher::ColorPreference systemPreference() const override;
0021 
0022 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0023     bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override;
0024 #else
0025     bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *) override;
0026 #endif
0027 
0028 private:
0029     QSettings m_settings{QStringLiteral("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"), QSettings::NativeFormat};
0030     bool m_preferDarkMode = false;
0031 };
0032 
0033 #endif