1 /*
2  * SPDX-FileCopyrightText: 2019 Mikhail Zolotukhin <zomial@protonmail.com>
3  * SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
4  *
5  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
6  */
7 
8 #pragma once
9 
10 #include <KConfigWatcher>
11 #include <KDEDModule>
12 
13 #include "configeditor.h"
14 #include "configvalueprovider.h"
15 #include "themepreviewer.h"
16 
17 class Q_DECL_EXPORT GtkConfig : public KDEDModule
18 {
19     Q_OBJECT
20     Q_CLASSINFO("D-Bus Interface", "org.kde.GtkConfig")
21 
22 public:
23     GtkConfig(QObject *parent, const QVariantList &args);
24     ~GtkConfig();
25 
26     void setFont() const;
27     void setIconTheme() const;
28     void setCursorTheme() const;
29     void setCursorSize() const;
30     void setIconsOnButtons() const;
31     void setIconsInMenus() const;
32     void setToolbarStyle() const;
33     void setScrollbarBehavior() const;
34     void setDarkThemePreference() const;
35     void setWindowDecorationsAppearance() const;
36     void setWindowDecorationsButtonsOrder() const;
37     void setEnableAnimations() const;
38     void setColors() const;
39 
40     void applyAllSettings() const;
41 
42 public Q_SLOTS:
43     Q_SCRIPTABLE void setGtkTheme(const QString &themeName) const;
44     Q_SCRIPTABLE QString gtkTheme() const;
45     Q_SCRIPTABLE void showGtkThemePreview(const QString &themeName) const;
46 
47     void onKdeglobalsSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
48     void onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
49     void onKCMInputSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
50     void onBreezeSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
51 
52 private:
53     QScopedPointer<ConfigValueProvider> configValueProvider;
54     QScopedPointer<ThemePreviewer> themePreviewer;
55     KConfigWatcher::Ptr kdeglobalsConfigWatcher;
56     KConfigWatcher::Ptr kwinConfigWatcher;
57     KConfigWatcher::Ptr kcminputConfigWatcher;
58     KConfigWatcher::Ptr breezeConfigWatcher;
59 };
60