Changeset View
Changeset View
Standalone View
Standalone View
keyboard_layout.h
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU General Public License | 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/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_KEYBOARD_LAYOUT_H | 20 | #ifndef KWIN_KEYBOARD_LAYOUT_H | ||
21 | #define KWIN_KEYBOARD_LAYOUT_H | 21 | #define KWIN_KEYBOARD_LAYOUT_H | ||
22 | 22 | | |||
23 | #include "input_event_spy.h" | 23 | #include "input_event_spy.h" | ||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | | ||||
26 | #include <KSharedConfig> | ||||
25 | typedef uint32_t xkb_layout_index_t; | 27 | typedef uint32_t xkb_layout_index_t; | ||
26 | 28 | | |||
29 | class KStatusNotifierItem; | ||||
30 | | ||||
27 | namespace KWin | 31 | namespace KWin | ||
28 | { | 32 | { | ||
29 | class Xkb; | 33 | class Xkb; | ||
30 | 34 | | |||
31 | class KeyboardLayout : public QObject, public InputEventSpy | 35 | class KeyboardLayout : public QObject, public InputEventSpy | ||
32 | { | 36 | { | ||
33 | Q_OBJECT | 37 | Q_OBJECT | ||
34 | public: | 38 | public: | ||
35 | explicit KeyboardLayout(Xkb *xkb); | 39 | explicit KeyboardLayout(Xkb *xkb); | ||
36 | ~KeyboardLayout() override; | 40 | ~KeyboardLayout() override; | ||
37 | 41 | | |||
42 | void setConfig(KSharedConfigPtr config) { | ||||
43 | m_config = config; | ||||
44 | } | ||||
45 | | ||||
38 | void init(); | 46 | void init(); | ||
39 | 47 | | |||
40 | void checkLayoutChange(); | 48 | void checkLayoutChange(); | ||
41 | void resetLayout(); | 49 | void resetLayout(); | ||
42 | 50 | | |||
43 | void keyEvent(KeyEvent *event) override; | 51 | void keyEvent(KeyEvent *event) override; | ||
44 | 52 | | |||
45 | private Q_SLOTS: | 53 | private Q_SLOTS: | ||
46 | void reconfigure(); | 54 | void reconfigure(); | ||
47 | 55 | | |||
48 | private: | 56 | private: | ||
49 | void notifyLayoutChange(); | 57 | void notifyLayoutChange(); | ||
58 | void initNotifierItem(); | ||||
59 | void switchToNextLayout(); | ||||
60 | void switchToPreviousLayout(); | ||||
61 | void updateNotifier(); | ||||
62 | void reinitNotifierMenu(); | ||||
50 | Xkb *m_xkb; | 63 | Xkb *m_xkb; | ||
51 | xkb_layout_index_t m_layout = 0; | 64 | xkb_layout_index_t m_layout = 0; | ||
65 | KStatusNotifierItem *m_notifierItem; | ||||
66 | KSharedConfigPtr m_config; | ||||
52 | }; | 67 | }; | ||
53 | 68 | | |||
54 | } | 69 | } | ||
55 | 70 | | |||
56 | #endif | 71 | #endif |