Warning, file /plasma/plasma-workspace/kcms/lookandfeel/kcm.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org> 0003 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> 0004 SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com> 0005 SPDX-FileCopyrightText: 2021 Benjamin Port <benjamin.port@enioka.com> 0006 SPDX-FileCopyrightText: 2022 Dominic Hayes <ferenosdev@outlook.com> 0007 0008 SPDX-License-Identifier: LGPL-2.0-only 0009 */ 0010 0011 #pragma once 0012 0013 #include <KConfig> 0014 #include <KConfigGroup> 0015 #include <KNSCore/EntryWrapper> 0016 #include <KSharedConfig> 0017 0018 #include <QDir> 0019 #include <QStandardItemModel> 0020 0021 #include <KPackage/Package> 0022 #include <KQuickAddons/ManagedConfigModule> 0023 0024 #include "lookandfeelmanager.h" 0025 #include "lookandfeelsettings.h" 0026 0027 class QQuickItem; 0028 class LookAndFeelManager; 0029 0030 class KCMLookandFeel : public KQuickAddons::ManagedConfigModule 0031 { 0032 Q_OBJECT 0033 Q_PROPERTY(LookAndFeelSettings *lookAndFeelSettings READ lookAndFeelSettings CONSTANT) 0034 Q_PROPERTY(QStandardItemModel *lookAndFeelModel READ lookAndFeelModel CONSTANT) 0035 Q_PROPERTY(LookAndFeelManager::AppearanceToApply appearanceToApply READ appearanceToApply WRITE setAppearanceToApply NOTIFY appearanceToApplyChanged RESET 0036 resetAppearanceToApply) 0037 Q_PROPERTY(LookAndFeelManager::LayoutToApply layoutToApply READ layoutToApply WRITE setLayoutToApply NOTIFY layoutToApplyChanged RESET resetLayoutToApply) 0038 0039 public: 0040 enum Roles { 0041 PluginNameRole = Qt::UserRole + 1, 0042 ScreenshotRole, 0043 FullScreenPreviewRole, 0044 DescriptionRole, 0045 HasSplashRole, 0046 HasLockScreenRole, 0047 HasRunCommandRole, 0048 HasLogoutRole, 0049 HasGlobalThemeRole, 0050 HasLayoutSettingsRole, 0051 HasDesktopLayoutRole, 0052 HasTitlebarLayoutRole, 0053 HasColorsRole, 0054 HasWidgetStyleRole, 0055 HasIconsRole, 0056 HasPlasmaThemeRole, 0057 HasCursorsRole, 0058 HasWindowSwitcherRole, 0059 HasDesktopSwitcherRole, 0060 HasWindowDecorationRole, 0061 HasFontsRole, 0062 }; 0063 Q_ENUM(Roles) 0064 0065 KCMLookandFeel(QObject *parent, const KPluginMetaData &data, const QVariantList &args); 0066 ~KCMLookandFeel() override; 0067 0068 LookAndFeelSettings *lookAndFeelSettings() const; 0069 QStandardItemModel *lookAndFeelModel() const; 0070 0071 Q_INVOKABLE int pluginIndex(const QString &pluginName) const; 0072 Q_INVOKABLE void knsEntryChanged(KNSCore::EntryWrapper *wrapper); 0073 Q_INVOKABLE void reloadConfig() 0074 { 0075 ManagedConfigModule::load(); 0076 } 0077 0078 LookAndFeelManager *lookAndFeel() const 0079 { 0080 return m_lnf; 0081 }; 0082 void addKPackageToModel(const KPackage::Package &pkg); 0083 0084 bool isSaveNeeded() const override; 0085 0086 LookAndFeelManager::AppearanceToApply appearanceToApply() const; 0087 void setAppearanceToApply(LookAndFeelManager::AppearanceToApply items); 0088 void resetAppearanceToApply(); 0089 LookAndFeelManager::LayoutToApply layoutToApply() const; 0090 void setLayoutToApply(LookAndFeelManager::LayoutToApply items); 0091 void resetLayoutToApply(); 0092 0093 public Q_SLOTS: 0094 void load() override; 0095 void save() override; 0096 void defaults() override; 0097 0098 Q_SIGNALS: 0099 void showConfirmation(); 0100 void appearanceToApplyChanged(); 0101 void layoutToApplyChanged(); 0102 0103 private: 0104 // List only packages which provide at least one of the components 0105 QList<KPackage::Package> availablePackages(const QStringList &components); 0106 void loadModel(); 0107 QDir cursorThemeDir(const QString &theme, const int depth); 0108 QStringList cursorSearchPaths(); 0109 void cursorsChanged(const QString &name); 0110 0111 LookAndFeelManager *const m_lnf; 0112 0113 QStandardItemModel *m_model; 0114 KPackage::Package m_package; 0115 QStringList m_cursorSearchPaths; 0116 };