KGuiAddons

kcolorschemewatcher.cpp
1/*
2 * SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "kcolorschemewatcher.h"
8
9#include "kcolorschemewatcher_qt.h"
10#include "kcolorschemewatcherbackend.h"
11
12#ifdef Q_OS_WINDOWS
13#include "kcolorschemewatcher_win.h"
14#endif
15
16#ifdef Q_OS_MACOS
17#include "kcolorschemewatcher_mac.h"
18#endif
19
20#ifdef QT_DBUS_LIB
21#include "kcolorschemewatcher_xdg.h"
22#endif
23
24class KColorSchemeWatcherPrivate
25{
26public:
27 std::unique_ptr<KColorSchemeWatcherBackend> backend;
28
29 KColorSchemeWatcherPrivate()
30 {
31#ifdef Q_OS_WINDOWS
32 backend = std::make_unique<KColorSchemeWatcherWin>();
33#elif defined(Q_OS_MACOS)
34 backend = std::make_unique<KColorSchemeWatcherMac>();
35#elif defined(QT_DBUS_LIB)
36 backend = std::make_unique<KColorSchemeWatcherXDG>();
37#else
38 backend = std::make_unique<KColorSchemeWatcherQt>();
39#endif
40 }
41};
42
43KColorSchemeWatcher::KColorSchemeWatcher(QObject *parent)
44 : QObject(parent)
45 , d(new KColorSchemeWatcherPrivate)
46{
47 if (d->backend) {
48 connect(d->backend.get(), &KColorSchemeWatcherBackend::systemPreferenceChanged, this, &KColorSchemeWatcher::systemPreferenceChanged);
49 }
50}
51
52KColorSchemeWatcher::~KColorSchemeWatcher()
53{
54}
55
57{
58 if (d->backend) {
59 return d->backend->systemPreference();
60 }
61
62 return NoPreference;
63}
64
65#include "moc_kcolorschemewatcher.cpp"
ColorPreference systemPreference() const
The system-wide color preference.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:51:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.