Diffstat (limited to 'core/apps/embeddedkonsole/keytrans.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/keytrans.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/core/apps/embeddedkonsole/keytrans.h b/core/apps/embeddedkonsole/keytrans.h new file mode 100644 index 0000000..ef6ed15 --- a/dev/null +++ b/core/apps/embeddedkonsole/keytrans.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | ||
2 | /* */ | ||
3 | /* [keytrans.h] X Terminal Emulation */ | ||
4 | /* */ | ||
5 | /* -------------------------------------------------------------------------- */ | ||
6 | /* */ | ||
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | ||
8 | /* */ | ||
9 | /* This file is part of Konsole - an X terminal for KDE */ | ||
10 | /* */ | ||
11 | /* -------------------------------------------------------------------------- */ | ||
12 | /* */ | ||
13 | /* Ported Konsole to Qt/Embedded */ | ||
14 | /* */ | ||
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | ||
16 | /* */ | ||
17 | /* -------------------------------------------------------------------------- */ | ||
18 | |||
19 | #ifndef KEYTRANS_H | ||
20 | #define KEYTRANS_H | ||
21 | |||
22 | #include <qstring.h> | ||
23 | #include <qlist.h> | ||
24 | #include <qiodevice.h> | ||
25 | |||
26 | #define BITS_NewLine 0 | ||
27 | #define BITS_BsHack 1 | ||
28 | #define BITS_Ansi 2 | ||
29 | #define BITS_AppCuKeys 3 | ||
30 | #define BITS_Control 4 | ||
31 | #define BITS_Shift 5 | ||
32 | #define BITS_Alt 6 | ||
33 | #define BITS_COUNT 7 | ||
34 | |||
35 | #define CMD_send 0 | ||
36 | #define CMD_emitSelection 1 | ||
37 | #define CMD_scrollPageUp 2 | ||
38 | #define CMD_scrollPageDown 3 | ||
39 | #define CMD_scrollLineUp 4 | ||
40 | #define CMD_scrollLineDown 5 | ||
41 | #define CMD_prevSession 6 | ||
42 | #define CMD_nextSession 7 | ||
43 | |||
44 | #define BITS(x,v) ((((v)!=0)<<(x))) | ||
45 | |||
46 | |||
47 | class KeyTrans | ||
48 | { | ||
49 | public: | ||
50 | KeyTrans(); | ||
51 | ~KeyTrans(); | ||
52 | static KeyTrans* defaultKeyTrans(); | ||
53 | static KeyTrans* fromFile(const char* path); | ||
54 | static KeyTrans* find(int numb); | ||
55 | static KeyTrans* find(const char* path); | ||
56 | public: | ||
57 | static int count(); | ||
58 | static void loadAll(); | ||
59 | public: | ||
60 | bool findEntry(int key, int bits, int* cmd, const char** txt, int* len); | ||
61 | private: | ||
62 | void addKeyTrans(); | ||
63 | static KeyTrans* fromDevice(QString path, QIODevice &buf); | ||
64 | public: | ||
65 | class KeyEntry | ||
66 | { | ||
67 | public: | ||
68 | KeyEntry(int ref, int key, int bits, int mask, int cmd, QString txt); | ||
69 | ~KeyEntry(); | ||
70 | public: | ||
71 | bool matches(int key, int bits, int mask); | ||
72 | QString text(); | ||
73 | public: | ||
74 | int ref; | ||
75 | private: | ||
76 | int key; | ||
77 | int bits; | ||
78 | int mask; | ||
79 | public: | ||
80 | int cmd; | ||
81 | QString txt; | ||
82 | }; | ||
83 | public: | ||
84 | KeyEntry* addEntry(int ref, int key, int bits, int mask, int cmd, QString txt); | ||
85 | private: | ||
86 | QList<KeyEntry> table; | ||
87 | public: //FIXME: we'd do better | ||
88 | QString hdr; | ||
89 | int numb; | ||
90 | QString path; | ||
91 | }; | ||
92 | |||
93 | #endif | ||