-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 89937cf..e3d3928 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -42,409 +42,411 @@ | |||
42 | /* Keyboard::Keyboard {{{1 */ | 42 | /* Keyboard::Keyboard {{{1 */ |
43 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 43 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
44 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), | 44 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), |
45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), | 45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), |
46 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 46 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
47 | configdlg(0) | 47 | configdlg(0) |
48 | 48 | ||
49 | { | 49 | { |
50 | 50 | ||
51 | // get the default font | 51 | // get the default font |
52 | Config *config = new Config( "qpe" ); | 52 | Config *config = new Config( "qpe" ); |
53 | config->setGroup( "Appearance" ); | 53 | config->setGroup( "Appearance" ); |
54 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); | 54 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); |
55 | delete config; | 55 | delete config; |
56 | 56 | ||
57 | config = new Config("multikey"); | 57 | config = new Config("multikey"); |
58 | config->setGroup ("general"); | 58 | config->setGroup ("general"); |
59 | usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed | 59 | usePicks = config->readBoolEntry ("usePickboard", "0"); // default closed |
60 | useRepeat = config->readBoolEntry ("useRepeat", "1"); | 60 | useRepeat = config->readBoolEntry ("useRepeat", "1"); |
61 | delete config; | 61 | delete config; |
62 | 62 | ||
63 | 63 | ||
64 | setFont( QFont( familyStr, 10 ) ); | 64 | setFont( QFont( familyStr, 10 ) ); |
65 | 65 | ||
66 | picks = new KeyboardPicks( this ); | 66 | picks = new KeyboardPicks( this ); |
67 | picks->setFont( QFont( familyStr, 10 ) ); | 67 | picks->setFont( QFont( familyStr, 10 ) ); |
68 | picks->initialise(); | 68 | picks->initialise(); |
69 | if (usePicks) { | 69 | if (usePicks) { |
70 | 70 | ||
71 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 71 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
72 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 72 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
73 | 73 | ||
74 | } else picks->hide(); | 74 | } else picks->hide(); |
75 | 75 | ||
76 | loadKeyboardColors(); | 76 | loadKeyboardColors(); |
77 | 77 | ||
78 | keys = new Keys(); | 78 | keys = new Keys(); |
79 | 79 | ||
80 | repeatTimer = new QTimer( this ); | 80 | repeatTimer = new QTimer( this ); |
81 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 81 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
82 | 82 | ||
83 | } | 83 | } |
84 | 84 | ||
85 | Keyboard::~Keyboard() { | 85 | Keyboard::~Keyboard() { |
86 | 86 | ||
87 | if ( configdlg ) { | 87 | if ( configdlg ) { |
88 | delete (ConfigDlg *) configdlg; | 88 | delete (ConfigDlg *) configdlg; |
89 | configdlg = 0; | 89 | configdlg = 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | } | 92 | } |
93 | 93 | ||
94 | /* Keyboard::resizeEvent {{{1 */ | 94 | /* Keyboard::resizeEvent {{{1 */ |
95 | void Keyboard::resizeEvent(QResizeEvent*) | 95 | void Keyboard::resizeEvent(QResizeEvent*) |
96 | { | 96 | { |
97 | int ph = picks->sizeHint().height(); | 97 | int ph = picks->sizeHint().height(); |
98 | picks->setGeometry( 0, 0, width(), ph ); | 98 | picks->setGeometry( 0, 0, width(), ph ); |
99 | keyHeight = (height()-(usePicks ? ph : 0))/5; | 99 | keyHeight = (height()-(usePicks ? ph : 0))/5; |
100 | 100 | ||
101 | int nk; // number of keys? | 101 | int nk; // number of keys? |
102 | if ( useLargeKeys ) { | 102 | if ( useLargeKeys ) { |
103 | nk = 15; | 103 | nk = 15; |
104 | } else { | 104 | } else { |
105 | nk = 19; | 105 | nk = 19; |
106 | } | 106 | } |
107 | defaultKeyWidth = (width()/nk)/2; | 107 | defaultKeyWidth = (width()/nk)/2; |
108 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? | 108 | xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? |
109 | 109 | ||
110 | } | 110 | } |
111 | 111 | ||
112 | /* KeyboardPicks::initialize {{{1 */ | 112 | /* KeyboardPicks::initialize {{{1 */ |
113 | void KeyboardPicks::initialise() | 113 | void KeyboardPicks::initialise() |
114 | { | 114 | { |
115 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 115 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
116 | mode = 0; | 116 | mode = 0; |
117 | dc = new KeyboardConfig(this); | 117 | dc = new KeyboardConfig(this); |
118 | configs.append(dc); | 118 | configs.append(dc); |
119 | } | 119 | } |
120 | 120 | ||
121 | /* KeyboardPicks::sizeHint {{{1 */ | 121 | /* KeyboardPicks::sizeHint {{{1 */ |
122 | QSize KeyboardPicks::sizeHint() const | 122 | QSize KeyboardPicks::sizeHint() const |
123 | { | 123 | { |
124 | return QSize(240,fontMetrics().lineSpacing()); | 124 | return QSize(240,fontMetrics().lineSpacing()); |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | /* KeyboardConfig::generateText {{{1 */ | 128 | /* KeyboardConfig::generateText {{{1 */ |
129 | void KeyboardConfig::generateText(const QString &s) | 129 | void KeyboardConfig::generateText(const QString &s) |
130 | { | 130 | { |
131 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 131 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
132 | for (int i=0; i<(int)backspaces; i++) { | 132 | for (int i=0; i<(int)backspaces; i++) { |
133 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 133 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); |
134 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 134 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); |
135 | } | 135 | } |
136 | for (int i=0; i<(int)s.length(); i++) { | 136 | for (int i=0; i<(int)s.length(); i++) { |
137 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 137 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
138 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 138 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
139 | } | 139 | } |
140 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 140 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); |
141 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 141 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); |
142 | backspaces = 0; | 142 | backspaces = 0; |
143 | #endif | 143 | #endif |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | /* Keyboard::paintEvent {{{1 */ | 149 | /* Keyboard::paintEvent {{{1 */ |
150 | void Keyboard::paintEvent(QPaintEvent* e) | 150 | void Keyboard::paintEvent(QPaintEvent* e) |
151 | { | 151 | { |
152 | QPainter painter(this); | 152 | QPainter painter(this); |
153 | painter.setClipRect(e->rect()); | 153 | painter.setClipRect(e->rect()); |
154 | drawKeyboard( painter ); | 154 | drawKeyboard( painter ); |
155 | picks->dc->draw( &painter ); | 155 | picks->dc->draw( &painter ); |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | /* Keyboard::drawKeyboard {{{1 */ | 159 | /* Keyboard::drawKeyboard {{{1 */ |
160 | 160 | ||
161 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) | 161 | void Keyboard::drawKeyboard(QPainter &p, int row, int col) |
162 | { | 162 | { |
163 | 163 | ||
164 | 164 | ||
165 | if (row != -1 && col != -1) { //just redraw one key | 165 | if (row != -1 && col != -1) { //just redraw one key |
166 | 166 | ||
167 | int x = 0; | 167 | int x = 0; |
168 | for (int i = 0; i < col; i++) { | 168 | for (int i = 0; i < col; i++) { |
169 | 169 | ||
170 | x += keys->width(row, i) * defaultKeyWidth; | 170 | x += keys->width(row, i) * defaultKeyWidth; |
171 | } | 171 | } |
172 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 172 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
173 | 173 | ||
174 | int keyWidth = keys->width(row, col); | 174 | int keyWidth = keys->width(row, col); |
175 | 175 | ||
176 | p.fillRect(x + 1, y + 1, | 176 | p.fillRect(x + 1, y + 1, |
177 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, | 177 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, |
178 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); | 178 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); |
179 | 179 | ||
180 | QPixmap *pix = keys->pix(row,col); | 180 | QPixmap *pix = keys->pix(row,col); |
181 | 181 | ||
182 | ushort c = keys->uni(row, col); | 182 | ushort c = keys->uni(row, col); |
183 | 183 | ||
184 | p.setPen(textcolor); | 184 | p.setPen(textcolor); |
185 | if (!pix) { | 185 | if (!pix) { |
186 | if (shift || lock) | 186 | if (shift || lock) |
187 | c = keys->shift(c); | 187 | c = keys->shift(c); |
188 | if (meta) { | 188 | if (meta) { |
189 | 189 | ||
190 | c = keys->meta(c); | 190 | c = keys->meta(c); |
191 | } | 191 | } |
192 | p.drawText(x, y, | 192 | p.drawText(x, y, |
193 | defaultKeyWidth * keyWidth + 3, keyHeight, | 193 | defaultKeyWidth * keyWidth + 3, keyHeight, |
194 | AlignCenter, (QChar)c); | 194 | AlignCenter, (QChar)c); |
195 | } | 195 | } |
196 | else | 196 | else |
197 | // center the image in the middle of the key | 197 | // center the image in the middle of the key |
198 | p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, | 198 | p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, |
199 | y + (keyHeight - pix->height())/2 + 1, | 199 | y + (keyHeight - pix->height())/2 + 1, |
200 | *pix ); | 200 | *pix ); |
201 | 201 | ||
202 | // this fixes the problem that the very right end of the board's vertical line | 202 | // this fixes the problem that the very right end of the board's vertical line |
203 | // gets painted over, because it's one pixel shorter than all other keys | 203 | // gets painted over, because it's one pixel shorter than all other keys |
204 | p.setPen(keycolor_lines); | 204 | p.setPen(keycolor_lines); |
205 | p.drawLine(width() - 1, 0, width() - 1, height()); | 205 | p.drawLine(width() - 1, 0, width() - 1, height()); |
206 | 206 | ||
207 | } else { | 207 | } else { |
208 | 208 | ||
209 | 209 | ||
210 | p.fillRect(0, 0, width(), height(), keycolor); | 210 | p.fillRect(0, 0, width(), height(), keycolor); |
211 | 211 | ||
212 | for (row = 1; row <= 5; row++) { | 212 | for (row = 1; row <= 5; row++) { |
213 | 213 | ||
214 | int x = 0; | 214 | int x = 0; |
215 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 215 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
216 | 216 | ||
217 | p.setPen(keycolor_lines); | 217 | p.setPen(keycolor_lines); |
218 | p.drawLine(x, y, x + width(), y); | 218 | p.drawLine(x, y, x + width(), y); |
219 | 219 | ||
220 | for (int col = 0; col < keys->numKeys(row); col++) { | 220 | for (int col = 0; col < keys->numKeys(row); col++) { |
221 | 221 | ||
222 | QPixmap *pix = keys->pix(row, col); | 222 | QPixmap *pix = keys->pix(row, col); |
223 | int keyWidth = keys->width(row, col); | 223 | int keyWidth = keys->width(row, col); |
224 | 224 | ||
225 | 225 | ||
226 | int keyWidthPix = defaultKeyWidth * keyWidth; | 226 | int keyWidthPix = defaultKeyWidth * keyWidth; |
227 | 227 | ||
228 | if (keys->pressed(row, col)) | 228 | if (keys->pressed(row, col)) |
229 | p.fillRect(x+1, y+1, keyWidthPix - 1, | 229 | p.fillRect(x+1, y+1, keyWidthPix - 1, |
230 | keyHeight - 1, keycolor_pressed); | 230 | keyHeight - 1, keycolor_pressed); |
231 | 231 | ||
232 | ushort c = keys->uni(row, col); | 232 | ushort c = keys->uni(row, col); |
233 | 233 | ||
234 | p.setPen(textcolor); | ||
234 | if (!pix) { | 235 | if (!pix) { |
235 | if ((shift || lock) && keys->shift(c)) | 236 | if ((shift || lock) && keys->shift(c)) |
236 | c = keys->shift(c); | 237 | c = keys->shift(c); |
237 | else if (meta && keys->meta(c)) | 238 | else if (meta && keys->meta(c)) |
238 | c = keys->meta(c); | 239 | c = keys->meta(c); |
239 | 240 | ||
240 | p.drawText(x, y, | 241 | p.drawText(x, y, |
241 | defaultKeyWidth * keyWidth + 3, keyHeight, | 242 | keyWidthPix + 3, keyHeight, |
242 | AlignCenter, (QChar)c); | 243 | AlignCenter, (QChar)c); |
243 | } | 244 | } |
244 | else { | 245 | else { |
245 | // center the image in the middle of the key | 246 | // center the image in the middle of the key |
246 | p.drawPixmap( x + (keyWidthPix - pix->width())/2, | 247 | p.drawPixmap( x + (keyWidthPix - pix->width())/2, |
247 | y + (keyHeight - pix->height())/2 + 1, | 248 | y + (keyHeight - pix->height())/2 + 1, |
248 | QPixmap(*pix) ); | 249 | QPixmap(*pix) ); |
249 | } | 250 | } |
250 | 251 | ||
251 | p.setPen(keycolor_lines); | 252 | p.setPen(keycolor_lines); |
252 | p.drawLine(x, y, x, y + keyHeight); | 253 | p.drawLine(x, y, x, y + keyHeight); |
253 | 254 | ||
254 | x += keyWidthPix; | 255 | x += keyWidthPix; |
255 | } | 256 | } |
256 | 257 | ||
257 | 258 | ||
258 | } | 259 | } |
260 | p.setPen(keycolor_lines); | ||
259 | p.drawLine(0, height() - 1, width(), height() - 1); | 261 | p.drawLine(0, height() - 1, width(), height() - 1); |
260 | p.drawLine(width() - 1, 0, width() - 1, height()); | 262 | p.drawLine(width() - 1, 0, width() - 1, height()); |
261 | } | 263 | } |
262 | 264 | ||
263 | } | 265 | } |
264 | 266 | ||
265 | 267 | ||
266 | /* Keyboard::mousePressEvent {{{1 */ | 268 | /* Keyboard::mousePressEvent {{{1 */ |
267 | void Keyboard::mousePressEvent(QMouseEvent *e) | 269 | void Keyboard::mousePressEvent(QMouseEvent *e) |
268 | { | 270 | { |
269 | int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; | 271 | int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; |
270 | if (row > 5) row = 5; | 272 | if (row > 5) row = 5; |
271 | 273 | ||
272 | // figure out the column | 274 | // figure out the column |
273 | int col = 0; | 275 | int col = 0; |
274 | for (int w = 0; e->x() >= w; col++) | 276 | for (int w = 0; e->x() >= w; col++) |
275 | if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys | 277 | if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys |
276 | w += keys->width(row,col) * defaultKeyWidth; | 278 | w += keys->width(row,col) * defaultKeyWidth; |
277 | else break; | 279 | else break; |
278 | 280 | ||
279 | if (col <= 0) return; | 281 | if (col <= 0) return; |
280 | 282 | ||
281 | col --; // rewind one... | 283 | col --; // rewind one... |
282 | 284 | ||
283 | qkeycode = keys->qcode(row, col); | 285 | qkeycode = keys->qcode(row, col); |
284 | unicode = keys->uni(row, col); | 286 | unicode = keys->uni(row, col); |
285 | 287 | ||
286 | // might need to repaint if two or more of the same keys. | 288 | // might need to repaint if two or more of the same keys. |
287 | // should be faster if just paint one key even though multiple keys exist. | 289 | // should be faster if just paint one key even though multiple keys exist. |
288 | bool need_repaint = FALSE; | 290 | bool need_repaint = FALSE; |
289 | 291 | ||
290 | if (unicode == 0) { // either Qt char, or nothing | 292 | if (unicode == 0) { // either Qt char, or nothing |
291 | 293 | ||
292 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard | 294 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard |
293 | 295 | ||
294 | if ( configdlg ) { | 296 | if ( configdlg ) { |
295 | delete (ConfigDlg *) configdlg; | 297 | delete (ConfigDlg *) configdlg; |
296 | configdlg = 0; | 298 | configdlg = 0; |
297 | } | 299 | } |
298 | else { | 300 | else { |
299 | configdlg = new ConfigDlg (); | 301 | configdlg = new ConfigDlg (); |
300 | connect(configdlg, SIGNAL(setMapToDefault()), | 302 | connect(configdlg, SIGNAL(setMapToDefault()), |
301 | this, SLOT(setMapToDefault())); | 303 | this, SLOT(setMapToDefault())); |
302 | connect(configdlg, SIGNAL(setMapToFile(QString)), | 304 | connect(configdlg, SIGNAL(setMapToFile(QString)), |
303 | this, SLOT(setMapToFile(QString))); | 305 | this, SLOT(setMapToFile(QString))); |
304 | connect(configdlg, SIGNAL(pickboardToggled(bool)), | 306 | connect(configdlg, SIGNAL(pickboardToggled(bool)), |
305 | this, SLOT(togglePickboard(bool))); | 307 | this, SLOT(togglePickboard(bool))); |
306 | connect(configdlg, SIGNAL(repeatToggled(bool)), | 308 | connect(configdlg, SIGNAL(repeatToggled(bool)), |
307 | this, SLOT(toggleRepeat(bool))); | 309 | this, SLOT(toggleRepeat(bool))); |
308 | connect(configdlg, SIGNAL(reloadKeyboard()), | 310 | connect(configdlg, SIGNAL(reloadKeyboard()), |
309 | this, SLOT(reloadKeyboard())); | 311 | this, SLOT(reloadKeyboard())); |
310 | configdlg->showMaximized(); | 312 | configdlg->showMaximized(); |
311 | configdlg->show(); | 313 | configdlg->show(); |
312 | configdlg->raise(); | 314 | configdlg->raise(); |
313 | } | 315 | } |
314 | 316 | ||
315 | } else if (qkeycode == Qt::Key_Control) { | 317 | } else if (qkeycode == Qt::Key_Control) { |
316 | need_repaint = TRUE; | 318 | need_repaint = TRUE; |
317 | 319 | ||
318 | if (ctrl) { | 320 | if (ctrl) { |
319 | 321 | ||
320 | *ctrl = 0; | 322 | *ctrl = 0; |
321 | ctrl = 0; | 323 | ctrl = 0; |
322 | 324 | ||
323 | } else { | 325 | } else { |
324 | 326 | ||
325 | ctrl = keys->pressedPtr(row, col); | 327 | ctrl = keys->pressedPtr(row, col); |
326 | need_repaint = TRUE; | 328 | need_repaint = TRUE; |
327 | *ctrl = !keys->pressed(row, col); | 329 | *ctrl = !keys->pressed(row, col); |
328 | 330 | ||
329 | } | 331 | } |
330 | 332 | ||
331 | } else if (qkeycode == Qt::Key_Alt) { | 333 | } else if (qkeycode == Qt::Key_Alt) { |
332 | need_repaint = TRUE; | 334 | need_repaint = TRUE; |
333 | 335 | ||
334 | if (alt) { | 336 | if (alt) { |
335 | *alt = 0; | 337 | *alt = 0; |
336 | alt = 0; | 338 | alt = 0; |
337 | 339 | ||
338 | } else { | 340 | } else { |
339 | 341 | ||
340 | alt = keys->pressedPtr(row, col); | 342 | alt = keys->pressedPtr(row, col); |
341 | need_repaint = TRUE; | 343 | need_repaint = TRUE; |
342 | *alt = !keys->pressed(row, col); | 344 | *alt = !keys->pressed(row, col); |
343 | } | 345 | } |
344 | 346 | ||
345 | } else if (qkeycode == Qt::Key_Shift) { | 347 | } else if (qkeycode == Qt::Key_Shift) { |
346 | need_repaint = TRUE; | 348 | need_repaint = TRUE; |
347 | 349 | ||
348 | if (shift) { | 350 | if (shift) { |
349 | *shift = 0; | 351 | *shift = 0; |
350 | shift = 0; | 352 | shift = 0; |
351 | } | 353 | } |
352 | else { | 354 | else { |
353 | shift = keys->pressedPtr(row, col); | 355 | shift = keys->pressedPtr(row, col); |
354 | *shift = 1; | 356 | *shift = 1; |
355 | if (lock) { | 357 | if (lock) { |
356 | *lock = 0; | 358 | *lock = 0; |
357 | lock = 0; | 359 | lock = 0; |
358 | } | 360 | } |
359 | } | 361 | } |
360 | if (meta) { | 362 | if (meta) { |
361 | 363 | ||
362 | *meta = 0; | 364 | *meta = 0; |
363 | meta = 0; | 365 | meta = 0; |
364 | } | 366 | } |
365 | 367 | ||
366 | } else if (qkeycode == Qt::Key_CapsLock) { | 368 | } else if (qkeycode == Qt::Key_CapsLock) { |
367 | need_repaint = TRUE; | 369 | need_repaint = TRUE; |
368 | 370 | ||
369 | if (lock) { | 371 | if (lock) { |
370 | *lock = 0; | 372 | *lock = 0; |
371 | lock = 0; | 373 | lock = 0; |
372 | } | 374 | } |
373 | else { | 375 | else { |
374 | lock = keys->pressedPtr(row, col);; | 376 | lock = keys->pressedPtr(row, col);; |
375 | *lock = 1; | 377 | *lock = 1; |
376 | if (shift) { | 378 | if (shift) { |
377 | *shift = 0; | 379 | *shift = 0; |
378 | shift = 0; | 380 | shift = 0; |
379 | } | 381 | } |
380 | } | 382 | } |
381 | if (meta) { | 383 | if (meta) { |
382 | 384 | ||
383 | *meta = 0; | 385 | *meta = 0; |
384 | meta = 0; | 386 | meta = 0; |
385 | } | 387 | } |
386 | 388 | ||
387 | } else if (qkeycode == Qt::Key_Meta) { | 389 | } else if (qkeycode == Qt::Key_Meta) { |
388 | need_repaint = TRUE; | 390 | need_repaint = TRUE; |
389 | 391 | ||
390 | if (meta) { | 392 | if (meta) { |
391 | *meta = 0; | 393 | *meta = 0; |
392 | meta = 0; | 394 | meta = 0; |
393 | 395 | ||
394 | } else { | 396 | } else { |
395 | 397 | ||
396 | meta = keys->pressedPtr(row, col); | 398 | meta = keys->pressedPtr(row, col); |
397 | need_repaint = TRUE; | 399 | need_repaint = TRUE; |
398 | *meta = !keys->pressed(row, col); | 400 | *meta = !keys->pressed(row, col); |
399 | } | 401 | } |
400 | 402 | ||
401 | if (shift) { | 403 | if (shift) { |
402 | 404 | ||
403 | *shift = 0; | 405 | *shift = 0; |
404 | shift = 0; | 406 | shift = 0; |
405 | 407 | ||
406 | } | 408 | } |
407 | if (lock) { | 409 | if (lock) { |
408 | 410 | ||
409 | *lock = 0; | 411 | *lock = 0; |
410 | lock = 0; | 412 | lock = 0; |
411 | 413 | ||
412 | } | 414 | } |
413 | 415 | ||
414 | // dont need to emit this key... acts same as alt | 416 | // dont need to emit this key... acts same as alt |
415 | qkeycode = 0; | 417 | qkeycode = 0; |
416 | } | 418 | } |
417 | 419 | ||
418 | } | 420 | } |
419 | else { // normal char | 421 | else { // normal char |
420 | if ((shift || lock) && keys->shift(unicode)) { | 422 | if ((shift || lock) && keys->shift(unicode)) { |
421 | unicode = keys->shift(unicode); | 423 | unicode = keys->shift(unicode); |
422 | } | 424 | } |
423 | if (meta && keys->meta(unicode)) { | 425 | if (meta && keys->meta(unicode)) { |
424 | unicode = keys->meta(unicode); | 426 | unicode = keys->meta(unicode); |
425 | } | 427 | } |
426 | } | 428 | } |
427 | 429 | ||
428 | // korean parsing | 430 | // korean parsing |
429 | if (keys->lang == "ko") { | 431 | if (keys->lang == "ko") { |
430 | 432 | ||
431 | unicode = parseKoreanInput(unicode); | 433 | unicode = parseKoreanInput(unicode); |
432 | } | 434 | } |
433 | 435 | ||
434 | modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); | 436 | modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); |
435 | 437 | ||
436 | if ('A' <= unicode && unicode <= 'z' && modifiers) { | 438 | if ('A' <= unicode && unicode <= 'z' && modifiers) { |
437 | 439 | ||
438 | qkeycode = QChar(unicode).upper(); | 440 | qkeycode = QChar(unicode).upper(); |
439 | unicode = qkeycode - '@'; | 441 | unicode = qkeycode - '@'; |
440 | } | 442 | } |
441 | 443 | ||
442 | QWSServer::sendKeyEvent(unicode, qkeycode, modifiers, true, false); | 444 | QWSServer::sendKeyEvent(unicode, qkeycode, modifiers, true, false); |
443 | 445 | ||
444 | // pickboard stuff | 446 | // pickboard stuff |
445 | if (usePicks) { | 447 | if (usePicks) { |
446 | 448 | ||
447 | KeyboardConfig *dc = picks->dc; | 449 | KeyboardConfig *dc = picks->dc; |
448 | 450 | ||
449 | if (dc) { | 451 | if (dc) { |
450 | if (qkeycode == Qt::Key_Backspace) { | 452 | if (qkeycode == Qt::Key_Backspace) { |