File indexing completed on 2024-10-13 13:11:20

0001 /*
0002  * SPDX-FileCopyrightText: 2019 Mikhail Zolotukhin <zomial@protonmail.com>
0003  * SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 #pragma once
0009 
0010 #include <KConfigWatcher>
0011 #include <KDEDModule>
0012 
0013 #include "configvalueprovider.h"
0014 #include "themepreviewer.h"
0015 
0016 class GSDXSettingsManager;
0017 
0018 class Q_DECL_EXPORT GtkConfig : public KDEDModule
0019 {
0020     Q_OBJECT
0021     Q_CLASSINFO("D-Bus Interface", "org.kde.GtkConfig")
0022 
0023 public:
0024     GtkConfig(QObject *parent, const QVariantList &args);
0025     ~GtkConfig();
0026 
0027     void setFont() const;
0028     void setIconTheme() const;
0029     void setCursorTheme() const;
0030     void setCursorSize() const;
0031     void setIconsOnButtons() const;
0032     void setIconsInMenus() const;
0033     void setToolbarStyle() const;
0034     void setScrollbarBehavior() const;
0035     void setDarkThemePreference() const;
0036     void setWindowDecorationsAppearance() const;
0037     void setWindowDecorationsButtonsOrder() const;
0038     void setEnableAnimations() const;
0039     void setGlobalScale() const;
0040     void setTextScale() const;
0041     void setColors() const;
0042 
0043     void applyAllSettings() const;
0044 
0045 public Q_SLOTS:
0046     Q_SCRIPTABLE void setGtkTheme(const QString &themeName) const;
0047     Q_SCRIPTABLE QString gtkTheme() const;
0048     Q_SCRIPTABLE void showGtkThemePreview(const QString &themeName) const;
0049 
0050     void onKdeglobalsSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0051     void onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0052     void onKCMFontsSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0053     void onKCMInputSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0054     void onBreezeSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0055 
0056 private:
0057     QScopedPointer<ConfigValueProvider> configValueProvider;
0058     QScopedPointer<ThemePreviewer> themePreviewer;
0059     KConfigWatcher::Ptr kdeglobalsConfigWatcher;
0060     KConfigWatcher::Ptr kwinConfigWatcher;
0061     KConfigWatcher::Ptr kcmfontsConfigWatcher;
0062     KConfigWatcher::Ptr kcminputConfigWatcher;
0063     KConfigWatcher::Ptr breezeConfigWatcher;
0064 
0065     GSDXSettingsManager *m_gsdXsettingsManager = nullptr;
0066 };