Diffstat (limited to 'noncore/applets/zkbapplet/keyzcfg/zkbcfg.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/zkbcfg.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/applets/zkbapplet/keyzcfg/zkbcfg.h b/noncore/applets/zkbapplet/keyzcfg/zkbcfg.h new file mode 100644 index 0000000..dc1ac07 --- a/dev/null +++ b/noncore/applets/zkbapplet/keyzcfg/zkbcfg.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef ZKBCFG_H | ||
2 | #define ZKBCFG_H | ||
3 | |||
4 | #include <qxml.h> | ||
5 | #include "zkb.h" | ||
6 | #include "zkbxml.h" | ||
7 | |||
8 | class ZkbConfig : public QXmlErrorHandler { | ||
9 | public: | ||
10 | ZkbConfig(const QString& dir); | ||
11 | virtual ~ZkbConfig(); | ||
12 | |||
13 | bool load(const QString& file, Keymap& keymap, const QString& prefix); | ||
14 | |||
15 | virtual bool warning(const QXmlParseException& e); | ||
16 | virtual bool error(const QXmlParseException& e); | ||
17 | virtual bool fatalError(const QXmlParseException& e); | ||
18 | virtual QString errorString(); | ||
19 | |||
20 | protected: | ||
21 | QString path; | ||
22 | QMap<QString, int> includedFiles; | ||
23 | QString err; | ||
24 | }; | ||
25 | |||
26 | class ZkbHandler : public ZkbXmlHandler { | ||
27 | public: | ||
28 | ZkbHandler(ZkbConfig& zkc, Keymap& keymap, const QString& prefix); | ||
29 | virtual ~ZkbHandler(); | ||
30 | |||
31 | protected: | ||
32 | ZkbConfig& zkc; | ||
33 | Keymap& keymap; | ||
34 | QString prefix; | ||
35 | |||
36 | // stuff for keymap tag | ||
37 | int ardelay; | ||
38 | int arperiod; | ||
39 | |||
40 | // stuff for state tag | ||
41 | QString currentStateName; | ||
42 | State* currentState; | ||
43 | |||
44 | // stuff for map tag | ||
45 | Action* currentAction; | ||
46 | |||
47 | virtual bool startKeymapElement(int ardelay, int arperiod, | ||
48 | const QString& author); | ||
49 | virtual bool startIncludeElement(const QString& file, | ||
50 | const QString& prfix); | ||
51 | virtual bool startLabelElement(const QString& label, | ||
52 | const QString& state); | ||
53 | virtual bool startStateElement(const QString& name, | ||
54 | const QString& parent, bool dflt); | ||
55 | virtual bool startMapElement(int key, bool pressed); | ||
56 | virtual bool startEventElement(int keycode, int unicode, int modifiers, | ||
57 | bool pressed, bool autorepeat); | ||
58 | virtual bool startNextStateElement(const QString& state); | ||
59 | |||
60 | virtual bool endKeymapElement(); | ||
61 | virtual bool endIncludeElement(); | ||
62 | virtual bool endLabelElement(); | ||
63 | virtual bool endStateElement(); | ||
64 | virtual bool endMapElement(); | ||
65 | virtual bool endEventElement(); | ||
66 | virtual bool endNextStateElement(); | ||
67 | }; | ||
68 | |||
69 | #endif | ||