KGuiAddons

kcolorschemewatcher_win.cpp
1/*
2 * SPDX-FileCopyrightText: 2020 Piyush Aggarwal <piyushaggarwal002@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "kcolorschemewatcher_win.h"
8
9#include <windows.h>
10
11#include <QAbstractEventDispatcher>
12
13#include <QDebug>
14
15KColorSchemeWatcherWin::KColorSchemeWatcherWin()
16{
18
19 m_preferDarkMode = !(m_settings.value(QStringLiteral("AppsUseLightTheme"), true).value<bool>());
20}
21
22bool KColorSchemeWatcherWin::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *)
23{
24 MSG *msg = static_cast<MSG *>(message);
25 switch (msg->message) {
26 case WM_SETTINGCHANGE: {
27 m_settings.sync();
28 const bool preferDarkModeNow = !(m_settings.value(QStringLiteral("AppsUseLightTheme"), true).value<bool>());
29 if (m_preferDarkMode != preferDarkModeNow) {
30 m_preferDarkMode = preferDarkModeNow;
31 Q_EMIT systemPreferenceChanged();
32 }
33
34 break;
35 }
36 default: {
37 }
38 }
39 return false;
40}
41
42KColorSchemeWatcher::ColorPreference KColorSchemeWatcherWin::systemPreference() const
43{
45}
46
47#include "moc_kcolorschemewatcher_win.cpp"
@ PreferLight
The user prefers a dark color scheme.
@ PreferDark
No preference available.
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj)
QAbstractEventDispatcher * instance(QThread *thread)
Q_EMITQ_EMIT
void sync()
QVariant value(QAnyStringView key) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.