Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindesktop/animationsmodel.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com> | ||||
6 | | ||||
7 | This program is free software; you can redistribute it and/or modify | ||||
8 | it under the terms of the GNU General Public License as published by | ||||
9 | the Free Software Foundation; either version 2 of the License, or | ||||
10 | (at your option) any later version. | ||||
11 | | ||||
12 | This program is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | GNU General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU General Public License | ||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | *********************************************************************/ | ||||
20 | | ||||
21 | #pragma once | ||||
22 | | ||||
23 | #include "effectmodel.h" | ||||
24 | | ||||
25 | namespace KWin | ||||
26 | { | ||||
27 | | ||||
28 | class AnimationsModel : public EffectModel | ||||
29 | { | ||||
30 | Q_OBJECT | ||||
31 | Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) | ||||
32 | Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) | ||||
33 | Q_PROPERTY(bool currentConfigurable READ currentConfigurable NOTIFY currentConfigurableChanged) | ||||
34 | | ||||
35 | public: | ||||
36 | explicit AnimationsModel(QObject *parent = nullptr); | ||||
37 | | ||||
38 | bool enabled() const; | ||||
39 | void setEnabled(bool enabled); | ||||
40 | | ||||
41 | int currentIndex() const; | ||||
42 | void setCurrentIndex(int index); | ||||
43 | | ||||
44 | bool currentConfigurable() const; | ||||
45 | | ||||
46 | void load(); | ||||
47 | void save(); | ||||
48 | void defaults(); | ||||
49 | bool needsSave() const; | ||||
50 | | ||||
51 | Q_SIGNALS: | ||||
52 | void enabledChanged(); | ||||
53 | void currentIndexChanged(); | ||||
54 | void currentConfigurableChanged(); | ||||
55 | | ||||
56 | protected: | ||||
57 | bool shouldStore(const EffectData &data) const override; | ||||
58 | | ||||
59 | private: | ||||
60 | Status status(int row) const; | ||||
61 | bool modelCurrentEnabled() const; | ||||
62 | int modelCurrentIndex() const; | ||||
63 | | ||||
64 | bool m_enabled = false; | ||||
65 | int m_currentIndex = -1; | ||||
66 | bool m_currentConfigurable = false; | ||||
67 | | ||||
68 | Q_DISABLE_COPY(AnimationsModel) | ||||
69 | }; | ||||
70 | | ||||
71 | } |