You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
4.5 KiB
141 lines
4.5 KiB
/* |
|
SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org> |
|
SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> |
|
SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com> |
|
SPDX-FileCopyrightText: 2021 Benjamin Port <benjamin.port@enioka.com> |
|
|
|
SPDX-License-Identifier: LGPL-2.0-only |
|
*/ |
|
|
|
#pragma once |
|
|
|
#include <KConfig> |
|
#include <KConfigGroup> |
|
#include <KNSCore/EntryWrapper> |
|
#include <KSharedConfig> |
|
|
|
#include <QDir> |
|
#include <QStandardItemModel> |
|
|
|
#include <KPackage/Package> |
|
#include <KQuickAddons/ManagedConfigModule> |
|
|
|
#include "lookandfeelsettings.h" |
|
|
|
class QQuickItem; |
|
class LookAndFeelData; |
|
|
|
class KCMLookandFeel : public KQuickAddons::ManagedConfigModule |
|
{ |
|
Q_OBJECT |
|
Q_PROPERTY(LookAndFeelSettings *lookAndFeelSettings READ lookAndFeelSettings CONSTANT) |
|
Q_PROPERTY(QStandardItemModel *lookAndFeelModel READ lookAndFeelModel CONSTANT) |
|
Q_PROPERTY(bool resetDefaultLayout READ resetDefaultLayout WRITE setResetDefaultLayout NOTIFY resetDefaultLayoutChanged) |
|
|
|
public: |
|
enum Roles { |
|
PluginNameRole = Qt::UserRole + 1, |
|
ScreenshotRole, |
|
FullScreenPreviewRole, |
|
DescriptionRole, |
|
HasSplashRole, |
|
HasLockScreenRole, |
|
HasRunCommandRole, |
|
HasLogoutRole, |
|
HasColorsRole, |
|
HasWidgetStyleRole, |
|
HasIconsRole, |
|
HasPlasmaThemeRole, |
|
HasCursorsRole, |
|
HasWindowSwitcherRole, |
|
HasDesktopSwitcherRole, |
|
}; |
|
|
|
KCMLookandFeel(QObject *parent, const QVariantList &args); |
|
~KCMLookandFeel() override; |
|
|
|
LookAndFeelSettings *lookAndFeelSettings() const; |
|
QStandardItemModel *lookAndFeelModel() const; |
|
|
|
Q_INVOKABLE int pluginIndex(const QString &pluginName) const; |
|
|
|
bool resetDefaultLayout() const; |
|
void setResetDefaultLayout(bool reset); |
|
|
|
// Setters of the various theme pieces |
|
void setWidgetStyle(const QString &style); |
|
void setColors(const QString &scheme, const QString &colorFile); |
|
void setIcons(const QString &theme); |
|
void setPlasmaTheme(const QString &theme); |
|
void setCursorTheme(const QString theme); |
|
void setSplashScreen(const QString &theme); |
|
void setLockScreen(const QString &theme); |
|
void setWindowSwitcher(const QString &theme); |
|
void setDesktopSwitcher(const QString &theme); |
|
void setWindowDecoration(const QString &library, const QString &theme); |
|
void setWindowPlacement(const QString &value); |
|
void setShellPackage(const QString &name); |
|
|
|
Q_INVOKABLE void knsEntryChanged(KNSCore::EntryWrapper *wrapper); |
|
Q_INVOKABLE void reloadConfig() |
|
{ |
|
ManagedConfigModule::load(); |
|
} |
|
|
|
void addKPackageToModel(const KPackage::Package &pkg); |
|
|
|
bool isSaveNeeded() const override; |
|
|
|
public Q_SLOTS: |
|
void load() override; |
|
void save() override; |
|
void defaults() override; |
|
|
|
Q_SIGNALS: |
|
void resetDefaultLayoutChanged(); |
|
|
|
private: |
|
// List only packages which provide at least one of the components |
|
QList<KPackage::Package> availablePackages(const QStringList &components); |
|
void loadModel(); |
|
QDir cursorThemeDir(const QString &theme, const int depth); |
|
const QStringList cursorSearchPaths(); |
|
|
|
void writeNewDefaults(const QString &filename, |
|
const QString &group, |
|
const QString &key, |
|
const QString &value, |
|
KConfig::WriteConfigFlags writeFlags = KConfig::Normal); |
|
void writeNewDefaults(KConfig &config, |
|
KConfig &configDefault, |
|
const QString &group, |
|
const QString &key, |
|
const QString &value, |
|
KConfig::WriteConfigFlags writeFlags = KConfig::Normal); |
|
void |
|
writeNewDefaults(KConfigGroup &cg, KConfigGroup &cgd, const QString &key, const QString &value, KConfig::WriteConfigFlags writeFlags = KConfig::Normal); |
|
|
|
static KConfig configDefaults(const QString &filename); |
|
|
|
LookAndFeelData *m_data; |
|
QStandardItemModel *m_model; |
|
KPackage::Package m_package; |
|
QStringList m_cursorSearchPaths; |
|
|
|
KSharedConfig::Ptr m_config; |
|
KConfigGroup m_configGroup; |
|
|
|
bool m_applyColors : 1; |
|
bool m_applyWidgetStyle : 1; |
|
bool m_applyIcons : 1; |
|
bool m_applyPlasmaTheme : 1; |
|
bool m_applyCursors : 1; |
|
bool m_applyWindowSwitcher : 1; |
|
bool m_applyDesktopSwitcher : 1; |
|
bool m_applyWindowPlacement : 1 = true; |
|
bool m_applyShellPackage : 1 = true; |
|
bool m_resetDefaultLayout : 1; |
|
bool m_applyWindowDecoration : 1; |
|
|
|
bool m_plasmashellChanged = false; |
|
};
|
|
|