File indexing completed on 2024-04-14 05:20:40

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 setSoundTheme() const;
0030     void setEventSoundsEnabled() const;
0031     void setCursorTheme() const;
0032     void setCursorSize() const;
0033     void setIconsOnButtons() const;
0034     void setIconsInMenus() const;
0035     void setToolbarStyle() const;
0036     void setScrollbarBehavior() const;
0037     void setDoubleClickInterval() const;
0038     void setDarkThemePreference() const;
0039     void setWindowDecorationsAppearance() const;
0040     void setWindowDecorationsButtonsOrder() const;
0041     void setEnableAnimations() const;
0042     void setGlobalScale() const;
0043     void setTextScale() const;
0044     void setColors() const;
0045 
0046     void applyAllSettings() const;
0047 
0048 public Q_SLOTS:
0049     Q_SCRIPTABLE void setGtkTheme(const QString &themeName) const;
0050     Q_SCRIPTABLE QString gtkTheme() const;
0051     Q_SCRIPTABLE void showGtkThemePreview(const QString &themeName) const;
0052 
0053     void onKdeglobalsSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0054     void onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0055     void onKCMFontsSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0056     void onKCMInputSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0057     void onBreezeSettingsChange(const KConfigGroup &group, const QByteArrayList &names) const;
0058 
0059 private:
0060     QScopedPointer<ConfigValueProvider> configValueProvider;
0061     QScopedPointer<ThemePreviewer> themePreviewer;
0062     KConfigWatcher::Ptr kdeglobalsConfigWatcher;
0063     KConfigWatcher::Ptr kwinConfigWatcher;
0064     KConfigWatcher::Ptr kcmfontsConfigWatcher;
0065     KConfigWatcher::Ptr kcminputConfigWatcher;
0066     KConfigWatcher::Ptr breezeConfigWatcher;
0067     void setGtk2Theme(const QString &themeName, const bool preferDarkTheme) const;
0068 
0069     GSDXSettingsManager *m_gsdXsettingsManager = nullptr;
0070 };