summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.h
Unidiff
Diffstat (limited to 'inputmethods/multikey/keyboard.h') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index dc50e55..b692975 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -41,113 +41,116 @@ private:
41class KeyboardPicks : public PickboardPicks 41class KeyboardPicks : public PickboardPicks
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) 45 KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0)
46 : PickboardPicks(parent, name, f) { } 46 : PickboardPicks(parent, name, f) { }
47 void initialise(); 47 void initialise();
48 virtual QSize sizeHint() const; 48 virtual QSize sizeHint() const;
49 KeyboardConfig *dc; 49 KeyboardConfig *dc;
50}; 50};
51 51
52 52
53class Keys { 53class Keys {
54public: 54public:
55 55
56 Keys(); 56 Keys();
57 Keys(const char * filename); 57 Keys(const char * filename);
58 ~Keys(); 58 ~Keys();
59 ushort uni(const int row, const int col); 59 ushort uni(const int row, const int col);
60 int qcode(const int row, const int col); 60 int qcode(const int row, const int col);
61 int width(const int row, const int col); 61 int width(const int row, const int col);
62 bool pressed(const int row, const int col); 62 bool pressed(const int row, const int col);
63 bool *pressedPtr(const int row, const int col); 63 bool *pressedPtr(const int row, const int col);
64 ushort shift(const ushort); 64 ushort shift(const ushort);
65 ushort meta(const ushort);
65 QPixmap *pix(const int row, const int col); 66 QPixmap *pix(const int row, const int col);
66 int numKeys(const int row); 67 int numKeys(const int row);
67 void setKeysFromFile(const char *filename); 68 void setKeysFromFile(const char *filename);
68 void setKey(const int row, const int qcode, const ushort unicode, 69 void setKey(const int row, const int qcode, const ushort unicode,
69 const int width, QPixmap *pix); 70 const int width, QPixmap *pix);
70 void setPressed(const int row, const int col, const bool pressed); 71 void setPressed(const int row, const int col, const bool pressed);
71 QString lang; 72 QString lang;
72 QString label; 73 QString label;
73 74
74private: 75private:
75 76
76 typedef struct Key { 77 typedef struct Key {
77 int qcode; // are qt key codes just unicode values? 78 int qcode; // are qt key codes just unicode values?
78 ushort unicode; 79 ushort unicode;
79 int width; // not pixels but relative key width. normal key is 2 80 int width; // not pixels but relative key width. normal key is 2
80 81
81 // only needed for keys like ctrl that can have multiple keys pressed at once 82 // only needed for keys like ctrl that can have multiple keys pressed at once
82 bool *pressed; 83 bool *pressed;
83 QPixmap *pix; 84 QPixmap *pix;
84 }; 85 };
85 86
86 QList<Key> keys[6]; 87 QList<Key> keys[6];
87 QMap<ushort,ushort> shiftMap; 88 QMap<ushort,ushort> shiftMap;
89 QMap<ushort,ushort> metaMap;
88 90
89}; 91};
90 92
91class Keyboard : public QFrame 93class Keyboard : public QFrame
92{ 94{
93 Q_OBJECT 95 Q_OBJECT
94public: 96public:
95 Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); 97 Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 );
96 ~Keyboard(); 98 ~Keyboard();
97 99
98 void resetState(); 100 void resetState();
99 101
100 void mousePressEvent(QMouseEvent*); 102 void mousePressEvent(QMouseEvent*);
101 void mouseReleaseEvent(QMouseEvent*); 103 void mouseReleaseEvent(QMouseEvent*);
102 void resizeEvent(QResizeEvent*); 104 void resizeEvent(QResizeEvent*);
103 void paintEvent(QPaintEvent* e); 105 void paintEvent(QPaintEvent* e);
104 //void timerEvent(QTimerEvent* e); 106 //void timerEvent(QTimerEvent* e);
105 void drawKeyboard( QPainter &p, int row = -1, int col = -1); 107 void drawKeyboard( QPainter &p, int row = -1, int col = -1);
106 108
107 QSize sizeHint() const; 109 QSize sizeHint() const;
108 110
109signals: 111signals:
110 void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); 112 void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool );
111 113
112private slots: 114private slots:
113 void repeat(); 115 void repeat();
114 void togglePickboard(bool on_off); 116 void togglePickboard(bool on_off);
115 void toggleRepeat(bool on_off); 117 void toggleRepeat(bool on_off);
116 void setMapToDefault(); 118 void setMapToDefault();
117 void setMapToFile(QString map); 119 void setMapToFile(QString map);
118 120
119 // used to redraw keyboard after edited colors 121 // used to redraw keyboard after edited colors
120 void reloadKeyboard(); 122 void reloadKeyboard();
121 123
122private: 124private:
123 int getKey( int &w, int j = -1 ); 125 int getKey( int &w, int j = -1 );
124 void clearHighlight(); 126 void clearHighlight();
125 127
126 bool *shift; 128 bool *shift;
127 bool *lock; 129 bool *lock;
128 bool *ctrl; 130 bool *ctrl;
129 bool *alt; 131 bool *alt;
132 bool *meta;
130 uint useLargeKeys:1; 133 uint useLargeKeys:1;
131 uint usePicks:1; 134 uint usePicks:1;
132 uint useRepeat:1; 135 uint useRepeat:1;
133 136
134 int pressedKeyRow; 137 int pressedKeyRow;
135 int pressedKeyCol; 138 int pressedKeyCol;
136 139
137 KeyboardPicks *picks; 140 KeyboardPicks *picks;
138 141
139 int keyHeight; 142 int keyHeight;
140 int defaultKeyWidth; 143 int defaultKeyWidth;
141 int xoffs; 144 int xoffs;
142 145
143 int unicode; 146 int unicode;
144 int qkeycode; 147 int qkeycode;
145 int modifiers; 148 int modifiers;
146 149
147 int pressTid; 150 int pressTid;
148 bool pressed; 151 bool pressed;
149 152
150 Keys *keys; 153 Keys *keys;
151 154
152 /* for korean input */ 155 /* for korean input */
153 ushort schar, mchar, echar; 156 ushort schar, mchar, echar;