Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwinscreenedges/main.h
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com> | 5 | Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com> | ||
6 | Copyright (C) 2020 Cyril Rossi <cyril.rossi@enioka.com> | ||||
6 | 7 | | |||
7 | This program is free software; you can redistribute it and/or modify | 8 | 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 | 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 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 11 | (at your option) any later version. | ||
11 | 12 | | |||
12 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 16 | GNU General Public License for more details. | ||
16 | 17 | | |||
17 | You should have received a copy of the GNU General Public License | 18 | 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 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 20 | *********************************************************************/ | ||
20 | 21 | | |||
21 | #ifndef __MAIN_H__ | 22 | #ifndef __MAIN_H__ | ||
22 | #define __MAIN_H__ | 23 | #define __MAIN_H__ | ||
23 | 24 | | |||
24 | #include <kcmodule.h> | 25 | #include <kcmodule.h> | ||
25 | #include <ksharedconfig.h> | 26 | #include <ksharedconfig.h> | ||
26 | 27 | | |||
27 | #include "kwinglobals.h" | 28 | #include "kwinglobals.h" | ||
28 | 29 | | |||
29 | #include "ui_main.h" | | |||
30 | | ||||
31 | class QShowEvent; | 30 | class QShowEvent; | ||
32 | 31 | | |||
33 | namespace KWin | 32 | namespace KWin | ||
34 | { | 33 | { | ||
34 | class KWinScreenEdgesConfigForm; | ||||
35 | class KWinScreenEdgeSettings; | ||||
36 | class KWinScreenEdgeScriptSettings; | ||||
35 | enum class BuiltInEffect; | 37 | enum class BuiltInEffect; | ||
36 | 38 | | |||
37 | class KWinScreenEdgesConfigForm : public QWidget, public Ui::KWinScreenEdgesConfigForm | | |||
38 | { | | |||
39 | Q_OBJECT | | |||
40 | | ||||
41 | public: | | |||
42 | explicit KWinScreenEdgesConfigForm(QWidget* parent); | | |||
43 | }; | | |||
44 | | ||||
45 | class KWinScreenEdgesConfig : public KCModule | 39 | class KWinScreenEdgesConfig : public KCModule | ||
46 | { | 40 | { | ||
47 | Q_OBJECT | 41 | Q_OBJECT | ||
48 | 42 | | |||
49 | public: | 43 | public: | ||
50 | explicit KWinScreenEdgesConfig(QWidget* parent, const QVariantList& args); | 44 | explicit KWinScreenEdgesConfig(QWidget *parent, const QVariantList &args); | ||
51 | ~KWinScreenEdgesConfig() override; | 45 | ~KWinScreenEdgesConfig() override; | ||
52 | 46 | | |||
53 | public Q_SLOTS: | 47 | public Q_SLOTS: | ||
54 | virtual void groupChanged(); | | |||
55 | void save() override; | 48 | void save() override; | ||
56 | void load() override; | 49 | void load() override; | ||
57 | void defaults() override; | 50 | void defaults() override; | ||
51 | | ||||
58 | protected: | 52 | protected: | ||
59 | void showEvent(QShowEvent* e) override; | 53 | void showEvent(QShowEvent *e) override; | ||
60 | private Q_SLOTS: | 54 | | ||
61 | void sanitizeCooldown(); | | |||
62 | private: | 55 | private: | ||
63 | KWinScreenEdgesConfigForm* m_ui; | 56 | KWinScreenEdgesConfigForm *m_form; | ||
64 | KSharedConfigPtr m_config; | 57 | KSharedConfigPtr m_config; | ||
65 | QStringList m_scripts; //list of script IDs ordered in the list they are presented in the menu | 58 | QStringList m_scripts; //list of script IDs ordered in the list they are presented in the menu | ||
59 | QHash<QString, KWinScreenEdgeScriptSettings*> m_scriptSettings; | ||||
60 | KWinScreenEdgeSettings *m_settings; | ||||
66 | 61 | | |||
67 | enum EffectActions { | 62 | enum EffectActions { | ||
68 | PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions | 63 | PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions | ||
69 | PresentWindowsCurrent, | 64 | PresentWindowsCurrent, | ||
70 | PresentWindowsClass, | 65 | PresentWindowsClass, | ||
71 | DesktopGrid, | 66 | DesktopGrid, | ||
72 | Cube, | 67 | Cube, | ||
73 | Cylinder, | 68 | Cylinder, | ||
74 | Sphere, | 69 | Sphere, | ||
75 | TabBox, | 70 | TabBox, | ||
76 | TabBoxAlternative, | 71 | TabBoxAlternative, | ||
77 | EffectCount | 72 | EffectCount | ||
78 | }; | 73 | }; | ||
79 | 74 | | |||
80 | bool effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const; | 75 | bool effectEnabled(const BuiltInEffect &effect, const KConfigGroup &cfg) const; | ||
81 | 76 | | |||
82 | void monitorAddItem(const QString& item); | | |||
83 | void monitorItemSetEnabled(int index, bool enabled); | | |||
84 | void monitorInit(); | 77 | void monitorInit(); | ||
85 | void monitorLoadAction(ElectricBorder edge, const QString& configName); | 78 | void monitorLoadSettings(); | ||
86 | void monitorLoad(); | 79 | void monitorLoadDefaultSettings(); | ||
87 | void monitorSaveAction(int edge, const QString& configName); | 80 | void monitorSaveSettings(); | ||
88 | void monitorSave(); | | |||
89 | void monitorDefaults(); | | |||
90 | void monitorShowEvent(); | 81 | void monitorShowEvent(); | ||
91 | void monitorChangeEdge(ElectricBorder border, int index); | 82 | | ||
92 | void monitorHideEdge(ElectricBorder border, bool hidden); | 83 | static ElectricBorderAction electricBorderActionFromString(const QString &string); | ||
93 | QList<int> monitorCheckEffectHasEdge(int index) const; | 84 | static QString electricBorderActionToString(int action); | ||
94 | }; | 85 | }; | ||
95 | 86 | | |||
96 | } // namespace | 87 | } // namespace | ||
97 | 88 | | |||
98 | #endif | 89 | #endif |