KWin
Loading...
Searching...
No Matches
kcm.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2019 Valerio Pilo <vpilo@coldshock.net>
3 SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#pragma once
9
10#include <KQuickManagedConfigModule>
11#include <QAbstractListModel>
12
13class QAbstractItemModel;
14class QSortFilterProxyModel;
15class QQuickItem;
16
17namespace KDecoration2
18{
19enum class BorderSize;
20
21namespace Preview
22{
23class ButtonsModel;
24}
25namespace Configuration
26{
27class DecorationsModel;
28}
29}
30
31class KWinDecorationSettings;
32class KWinDecorationData;
33
34class KCMKWinDecoration : public KQuickManagedConfigModule
35{
36 Q_OBJECT
37 Q_PROPERTY(KWinDecorationSettings *settings READ settings CONSTANT)
38 Q_PROPERTY(QSortFilterProxyModel *themesModel READ themesModel CONSTANT)
39 Q_PROPERTY(QStringList borderSizesModel READ borderSizesModel NOTIFY themeChanged)
40 Q_PROPERTY(int borderIndex READ borderIndex WRITE setBorderIndex NOTIFY borderIndexChanged)
41 Q_PROPERTY(int borderSize READ borderSize NOTIFY borderSizeChanged)
42 Q_PROPERTY(int recommendedBorderSize READ recommendedBorderSize CONSTANT)
43 Q_PROPERTY(int theme READ theme WRITE setTheme NOTIFY themeChanged)
44 Q_PROPERTY(QAbstractListModel *leftButtonsModel READ leftButtonsModel NOTIFY buttonsChanged)
45 Q_PROPERTY(QAbstractListModel *rightButtonsModel READ rightButtonsModel NOTIFY buttonsChanged)
46 Q_PROPERTY(QAbstractListModel *availableButtonsModel READ availableButtonsModel CONSTANT)
47
48public:
49 KCMKWinDecoration(QObject *parent, const KPluginMetaData &metaData);
50
51 KWinDecorationSettings *settings() const;
52 QSortFilterProxyModel *themesModel() const;
53 QAbstractListModel *leftButtonsModel();
54 QAbstractListModel *rightButtonsModel();
55 QAbstractListModel *availableButtonsModel() const;
56 QStringList borderSizesModel() const;
57 int borderIndex() const;
58 int borderSize() const;
59 int recommendedBorderSize() const;
60 int theme() const;
61
62 void setBorderIndex(int index);
63 void setBorderSize(int index);
64 void setBorderSize(KDecoration2::BorderSize size);
65 void setTheme(int index);
66
67Q_SIGNALS:
71
72public Q_SLOTS:
73 void load() override;
74 void save() override;
75 void defaults() override;
76 void reloadKWinSettings();
77
78private Q_SLOTS:
79 void onLeftButtonsChanged();
80 void onRightButtonsChanged();
81
83 bool isSaveNeeded() const override;
84
85 int borderSizeIndexFromString(const QString &size) const;
86 QString borderSizeIndexToString(int index) const;
87
88 KDecoration2::Configuration::DecorationsModel *m_themesModel;
89 QSortFilterProxyModel *m_proxyThemesModel;
90
91 KDecoration2::Preview::ButtonsModel *m_leftButtonsModel;
92 KDecoration2::Preview::ButtonsModel *m_rightButtonsModel;
93 KDecoration2::Preview::ButtonsModel *m_availableButtonsModel;
94
95 int m_borderSizeIndex = -1;
96 KWinDecorationData *m_data;
97};
void defaults() override
Definition kcm.cpp:132
int borderSize
Definition kcm.h:41
KWinDecorationSettings * settings
Definition kcm.h:37
void setBorderIndex(int index)
Definition kcm.cpp:186
QAbstractListModel * leftButtonsModel
Definition kcm.h:44
void save() override
Definition kcm.cpp:115
void setTheme(int index)
Definition kcm.cpp:230
int recommendedBorderSize
Definition kcm.h:42
void reloadKWinSettings()
Definition kcm.cpp:98
QSortFilterProxyModel * themesModel
Definition kcm.h:38
void borderIndexChanged()
QAbstractListModel * availableButtonsModel
Definition kcm.h:46
void load() override
Definition kcm.cpp:103
QStringList borderSizesModel
Definition kcm.h:39
void setBorderSize(int index)
Definition kcm.cpp:217
QAbstractListModel * rightButtonsModel
Definition kcm.h:45
int borderIndex
Definition kcm.h:40
void borderSizeChanged()
#define private