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

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KCOLORSCHEMEWATCHER_H
0008 #define KCOLORSCHEMEWATCHER_H
0009 
0010 #include "kguiaddons_export.h"
0011 
0012 #include <QObject>
0013 
0014 #include <memory>
0015 
0016 class KColorSchemeWatcherPrivate;
0017 
0018 /**
0019  * Information about system-wide color preferences.
0020  * @since 5.100
0021  */
0022 class KGUIADDONS_EXPORT KColorSchemeWatcher : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     enum ColorPreference {
0027         NoPreference = 0, /** No preference available */
0028         PreferDark, /** The user prefers a dark color scheme */
0029         PreferLight, /** The user prefers a light color scheme */
0030     };
0031     Q_ENUM(ColorPreference)
0032 
0033     KColorSchemeWatcher(QObject *parent = nullptr);
0034     ~KColorSchemeWatcher() override;
0035 
0036     /**
0037      * The system-wide color preference.
0038      */
0039     ColorPreference systemPreference() const;
0040 
0041 Q_SIGNALS:
0042     /**
0043      * Emitted when systemPreference changes.
0044      */
0045     void systemPreferenceChanged();
0046 
0047 private:
0048     std::unique_ptr<KColorSchemeWatcherPrivate> const d;
0049 };
0050 
0051 #endif