1 #ifndef _PLUGIN_H_INCLUDED_
2 #define _PLUGIN_H_INCLUDED_
3 
4 #include <QtCore/QList>
5 
6 namespace GlobalHotkeys
7 {
8 
9 /*
10  * Values in this enum must not be skipped and must start with 0,
11  * otherwise event_desc in gui.cc and it's use must be updated.
12  * All values except for Event::Max must be present in event_desc map.
13  */
14 enum class Event
15 {
16     PrevTrack = 0,
17     Play,
18     Pause,
19     Stop,
20     NextTrack,
21 
22     Forward,
23     Backward,
24     Mute,
25     VolumeUp,
26     VolumeDown,
27     JumpToFile,
28     ToggleWindow,
29     ShowAOSD,
30 
31     ToggleRepeat,
32     ToggleShuffle,
33     ToggleStop,
34 
35     Raise,
36 
37     Max
38 };
39 
40 struct HotkeyConfiguration
41 {
42     unsigned key, mask;
43     Event event;
44 };
45 
46 struct PluginConfig
47 {
48     /* keyboard */
49     QList<HotkeyConfiguration> hotkeys_list;
50 };
51 
52 extern unsigned int numlock_mask;
53 extern unsigned int scrolllock_mask;
54 extern unsigned int capslock_mask;
55 
56 void load_config();
57 void save_config();
58 PluginConfig * get_config();
59 bool handle_keyevent(Event event);
60 
61 void grab_keys();
62 void ungrab_keys();
63 
64 } /* namespace GlobalHotkeys */
65 
66 #endif
67