Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwintabbox/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 Martin Gräßlin <mgraesslin@kde.org> | 5 | Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org> | ||
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 | #include "tabboxconfig.h" | | |||
27 | 27 | | |||
28 | #include "ui_main.h" | 28 | #include "ui_main.h" | ||
29 | 29 | | |||
30 | class KShortcutsEditor; | 30 | class KShortcutsEditor; | ||
31 | class KActionCollection; | 31 | class KActionCollection; | ||
32 | 32 | | |||
33 | namespace KWin | 33 | namespace KWin | ||
34 | { | 34 | { | ||
35 | enum class BuiltInEffect; | 35 | enum class BuiltInEffect; | ||
36 | namespace TabBox | 36 | namespace TabBox | ||
37 | { | 37 | { | ||
38 | 38 | class TabBoxSettings; | |||
39 | class SwitchEffectSettings; | ||||
40 | class PluginsSettings; | ||||
39 | } | 41 | } | ||
40 | 42 | | |||
41 | 43 | | |||
42 | 44 | | |||
43 | class KWinTabBoxConfigForm : public QWidget, public Ui::KWinTabBoxConfigForm | 45 | class KWinTabBoxConfigForm : public QWidget, public Ui::KWinTabBoxConfigForm | ||
44 | { | 46 | { | ||
45 | Q_OBJECT | 47 | Q_OBJECT | ||
46 | 48 | | |||
Show All 16 Lines | |||||
63 | 65 | | |||
64 | private Q_SLOTS: | 66 | private Q_SLOTS: | ||
65 | void effectSelectionChanged(int index); | 67 | void effectSelectionChanged(int index); | ||
66 | void configureEffectClicked(); | 68 | void configureEffectClicked(); | ||
67 | void tabBoxToggled(bool on); | 69 | void tabBoxToggled(bool on); | ||
68 | void shortcutChanged(const QKeySequence &seq); | 70 | void shortcutChanged(const QKeySequence &seq); | ||
69 | void slotGHNS(); | 71 | void slotGHNS(); | ||
70 | private: | 72 | private: | ||
71 | void updateUiFromConfig(KWinTabBoxConfigForm* ui, const TabBox::TabBoxConfig& config); | 73 | void updateUiFromConfig(KWinTabBoxConfigForm *ui, const TabBox::TabBoxSettings *config); | ||
72 | void updateConfigFromUi(const KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config); | 74 | void updateConfigFromUi(const KWinTabBoxConfigForm *ui, TabBox::TabBoxSettings *config); | ||
73 | void loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig); | | |||
74 | void saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig); | | |||
75 | void initLayoutLists(); | 75 | void initLayoutLists(); | ||
zzag: Minor nitpick: it seems like there's no any reason to pass `config` by reference now. At each… | |||||
76 | 76 | | |||
77 | private: | 77 | private: | ||
78 | enum Mode { | 78 | enum Mode { | ||
79 | CoverSwitch = 0, | 79 | CoverSwitch = 0, | ||
80 | FlipSwitch = 1, | 80 | FlipSwitch = 1, | ||
81 | Layout = 2 | 81 | Layout = 2 | ||
82 | }; | 82 | }; | ||
83 | KWinTabBoxConfigForm* m_primaryTabBoxUi; | 83 | KWinTabBoxConfigForm* m_primaryTabBoxUi; | ||
84 | KWinTabBoxConfigForm* m_alternativeTabBoxUi; | 84 | KWinTabBoxConfigForm* m_alternativeTabBoxUi; | ||
85 | KSharedConfigPtr m_config; | 85 | KSharedConfigPtr m_config; | ||
86 | KActionCollection* m_actionCollection; | 86 | KActionCollection* m_actionCollection; | ||
87 | KShortcutsEditor* m_editor; | 87 | KShortcutsEditor* m_editor; | ||
88 | TabBox::TabBoxConfig m_tabBoxConfig; | 88 | TabBox::TabBoxSettings *m_tabBoxConfig; | ||
89 | TabBox::TabBoxConfig m_tabBoxAlternativeConfig; | 89 | TabBox::TabBoxSettings *m_tabBoxAlternativeConfig; | ||
90 | TabBox::SwitchEffectSettings *m_coverSwitchConfig; | ||||
91 | TabBox::SwitchEffectSettings *m_flipSwitchConfig; | ||||
92 | TabBox::PluginsSettings *m_pluginsConfig; | ||||
90 | 93 | | |||
91 | bool effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const; | | |||
92 | }; | 94 | }; | ||
93 | 95 | | |||
94 | } // namespace | 96 | } // namespace | ||
95 | 97 | | |||
96 | #endif | 98 | #endif |
Minor nitpick: it seems like there's no any reason to pass config by reference now. At each call site, we de-reference a settings object. I suggest to pass config by pointer.