Changeset View
Changeset View
Standalone View
Standalone View
globalshortcuts.h
Show All 15 Lines | |||||
16 | 16 | | |||
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_GLOBALSHORTCUTS_H | 20 | #ifndef KWIN_GLOBALSHORTCUTS_H | ||
21 | #define KWIN_GLOBALSHORTCUTS_H | 21 | #define KWIN_GLOBALSHORTCUTS_H | ||
22 | // KWin | 22 | // KWin | ||
23 | #include <kwinglobals.h> | 23 | #include <kwinglobals.h> | ||
24 | // KDE | | |||
25 | #include <KSharedConfig> | | |||
26 | // Qt | 24 | // Qt | ||
27 | #include <QKeySequence> | 25 | #include <QKeySequence> | ||
28 | 26 | | |||
29 | class QAction; | 27 | class QAction; | ||
30 | class KGlobalAccelD; | 28 | class KGlobalAccelD; | ||
31 | class KGlobalAccelInterface; | 29 | class KGlobalAccelInterface; | ||
32 | 30 | | |||
33 | namespace KWin | 31 | namespace KWin | ||
Show All 14 Lines | |||||
48 | { | 46 | { | ||
49 | Q_OBJECT | 47 | Q_OBJECT | ||
50 | public: | 48 | public: | ||
51 | explicit GlobalShortcutsManager(QObject *parent = nullptr); | 49 | explicit GlobalShortcutsManager(QObject *parent = nullptr); | ||
52 | virtual ~GlobalShortcutsManager(); | 50 | virtual ~GlobalShortcutsManager(); | ||
53 | void init(); | 51 | void init(); | ||
54 | 52 | | |||
55 | /** | 53 | /** | ||
56 | * @brief Registers an internal global shortcut | | |||
57 | * | | |||
58 | * @param action The action to trigger if the shortcut is pressed | | |||
59 | * @param shortcut The key sequence which triggers this shortcut | | |||
60 | */ | | |||
61 | void registerShortcut(QAction *action, const QKeySequence &shortcut); | | |||
62 | /** | | |||
63 | * @brief Registers an internal global pointer shortcut | 54 | * @brief Registers an internal global pointer shortcut | ||
64 | * | 55 | * | ||
65 | * @param action The action to trigger if the shortcut is pressed | 56 | * @param action The action to trigger if the shortcut is pressed | ||
66 | * @param modifiers The modifiers which need to be hold to trigger the action | 57 | * @param modifiers The modifiers which need to be hold to trigger the action | ||
67 | * @param pointerButtons The pointer button which needs to be pressed | 58 | * @param pointerButtons The pointer button which needs to be pressed | ||
68 | */ | 59 | */ | ||
69 | void registerPointerShortcut(QAction *action, Qt::KeyboardModifiers modifiers, Qt::MouseButtons pointerButtons); | 60 | void registerPointerShortcut(QAction *action, Qt::KeyboardModifiers modifiers, Qt::MouseButtons pointerButtons); | ||
70 | /** | 61 | /** | ||
Show All 33 Lines | |||||
104 | bool processAxis(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis); | 95 | bool processAxis(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis); | ||
105 | 96 | | |||
106 | void setKGlobalAccelInterface(KGlobalAccelInterface *interface) { | 97 | void setKGlobalAccelInterface(KGlobalAccelInterface *interface) { | ||
107 | m_kglobalAccelInterface = interface; | 98 | m_kglobalAccelInterface = interface; | ||
108 | } | 99 | } | ||
109 | 100 | | |||
110 | private: | 101 | private: | ||
111 | void objectDeleted(QObject *object); | 102 | void objectDeleted(QObject *object); | ||
112 | QKeySequence getShortcutForAction(const QString &componentName, const QString &actionName, const QKeySequence &defaultShortcut); | | |||
113 | QHash<Qt::KeyboardModifiers, QHash<uint32_t, GlobalShortcut*> > m_shortcuts; | | |||
114 | QHash<Qt::KeyboardModifiers, QHash<Qt::MouseButtons, GlobalShortcut*> > m_pointerShortcuts; | 103 | QHash<Qt::KeyboardModifiers, QHash<Qt::MouseButtons, GlobalShortcut*> > m_pointerShortcuts; | ||
115 | QHash<Qt::KeyboardModifiers, QHash<PointerAxisDirection, GlobalShortcut*> > m_axisShortcuts; | 104 | QHash<Qt::KeyboardModifiers, QHash<PointerAxisDirection, GlobalShortcut*> > m_axisShortcuts; | ||
116 | KSharedConfigPtr m_config; | | |||
117 | KGlobalAccelD *m_kglobalAccel = nullptr; | 105 | KGlobalAccelD *m_kglobalAccel = nullptr; | ||
118 | KGlobalAccelInterface *m_kglobalAccelInterface = nullptr; | 106 | KGlobalAccelInterface *m_kglobalAccelInterface = nullptr; | ||
119 | }; | 107 | }; | ||
120 | 108 | | |||
121 | class GlobalShortcut | 109 | class GlobalShortcut | ||
122 | { | 110 | { | ||
123 | public: | 111 | public: | ||
124 | virtual ~GlobalShortcut(); | 112 | virtual ~GlobalShortcut(); | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |