author | hash <hash> | 2002-09-06 21:23:05 (UTC) |
---|---|---|
committer | hash <hash> | 2002-09-06 21:23:05 (UTC) |
commit | fc4808bea669f75af0c28ba65cf2c638c97e99ba (patch) (unidiff) | |
tree | 2ced268c3d31f9dded6d8332698ee8e476a081c0 /inputmethods/multikey | |
parent | 15992c5f9b24eaf8df6f90d1993c85d73827b98f (diff) | |
download | opie-fc4808bea669f75af0c28ba65cf2c638c97e99ba.zip opie-fc4808bea669f75af0c28ba65cf2c638c97e99ba.tar.gz opie-fc4808bea669f75af0c28ba65cf2c638c97e99ba.tar.bz2 |
french and other stuff fixed
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 11 | ||||
-rw-r--r-- | inputmethods/multikey/configdlg.h | 3 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 323 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.h | 11 |
4 files changed, 299 insertions, 49 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 26c9233..a8206b7 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing (size too) | 3 | * make a font selection thing (size too) |
4 | * make vertical keys possible | ||
5 | * make a keymap editor | 4 | * make a keymap editor |
5 | * make keys translucent | ||
6 | * make vertical keys possible | ||
6 | * | 7 | * |
7 | * | 8 | * |
8 | */ | 9 | */ |
@@ -248,6 +249,12 @@ void ConfigDlg::repeatTog() { | |||
248 | emit repeatToggled(repeat_button->isChecked()); | 249 | emit repeatToggled(repeat_button->isChecked()); |
249 | } | 250 | } |
250 | 251 | ||
252 | void ConfigDlg::closeEvent(QCloseEvent *) { | ||
253 | |||
254 | // tell the parent it was closed, so delete me | ||
255 | emit configDlgClosed(); | ||
256 | } | ||
257 | |||
251 | // ConfigDlg::setMap {{{1 | 258 | // ConfigDlg::setMap {{{1 |
252 | 259 | ||
253 | /* | 260 | /* |
@@ -267,7 +274,7 @@ void ConfigDlg::setMap(int index) { | |||
267 | else if ((uint)index <= default_maps.count()) { | 274 | else if ((uint)index <= default_maps.count()) { |
268 | 275 | ||
269 | remove_button->setDisabled(true); | 276 | remove_button->setDisabled(true); |
270 | emit setMapToFile(QPEApplication::qpeDir() + "/share/multikey/" + default_maps[index - 1]); | 277 | emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + default_maps[index - 1]); |
271 | 278 | ||
272 | } else { | 279 | } else { |
273 | 280 | ||
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h index 5d6403f..336932b 100644 --- a/inputmethods/multikey/configdlg.h +++ b/inputmethods/multikey/configdlg.h | |||
@@ -20,6 +20,7 @@ signals: | |||
20 | void setMapToDefault(); | 20 | void setMapToDefault(); |
21 | void setMapToFile(QString map); | 21 | void setMapToFile(QString map); |
22 | void reloadKeyboard(); | 22 | void reloadKeyboard(); |
23 | void configDlgClosed(); | ||
23 | 24 | ||
24 | private slots: | 25 | private slots: |
25 | void pickTog(); | 26 | void pickTog(); |
@@ -27,6 +28,8 @@ private slots: | |||
27 | void setMap(int index); | 28 | void setMap(int index); |
28 | void addMap(); | 29 | void addMap(); |
29 | void removeMap(); | 30 | void removeMap(); |
31 | virtual void closeEvent ( QCloseEvent * ); | ||
32 | |||
30 | 33 | ||
31 | // all those required slots for the color push buttons | 34 | // all those required slots for the color push buttons |
32 | void keyColorClicked(); | 35 | void keyColorClicked(); |
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 4747f59..28d5cab 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -40,8 +40,10 @@ | |||
40 | 40 | ||
41 | /* Keyboard::Keyboard {{{1 */ | 41 | /* Keyboard::Keyboard {{{1 */ |
42 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 42 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
43 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), meta(0), | 43 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), |
44 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), pressedKeyRow(-1), pressedKeyCol(-1), | 44 | meta(0), circumflex(0), diaeresis(0), |
45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), | ||
46 | pressedKeyRow(-1), pressedKeyCol(-1), | ||
45 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), | 47 | unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), |
46 | configdlg(0) | 48 | configdlg(0) |
47 | 49 | ||
@@ -95,7 +97,7 @@ void Keyboard::resizeEvent(QResizeEvent*) | |||
95 | { | 97 | { |
96 | int ph = picks->sizeHint().height(); | 98 | int ph = picks->sizeHint().height(); |
97 | picks->setGeometry( 0, 0, width(), ph ); | 99 | picks->setGeometry( 0, 0, width(), ph ); |
98 | keyHeight = (height()-(usePicks ? ph : 0))/5; | 100 | keyHeight = (height()-(usePicks ? ph : 0))/keys->rows(); |
99 | 101 | ||
100 | int nk; // number of keys? | 102 | int nk; // number of keys? |
101 | if ( useLargeKeys ) { | 103 | if ( useLargeKeys ) { |
@@ -182,12 +184,32 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
182 | 184 | ||
183 | p.setPen(textcolor); | 185 | p.setPen(textcolor); |
184 | if (!pix) { | 186 | if (!pix) { |
185 | if (shift || lock) | 187 | if ((shift || lock) && keys->shift(c)) |
186 | c = keys->shift(c); | 188 | |
187 | if (meta) { | 189 | if (circumflex && keys->circumflex(keys->shift(c))) |
190 | c = keys->circumflex(keys->shift(c)); | ||
191 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | ||
192 | c = keys->diaeresis(keys->shift(c)); | ||
193 | else if (meta && keys->meta(keys->shift(c))) | ||
194 | c = keys->meta(keys->shift(c)); | ||
195 | else | ||
196 | c = keys->shift(c); | ||
188 | 197 | ||
198 | else if (meta && keys->meta(c)) | ||
189 | c = keys->meta(c); | 199 | c = keys->meta(c); |
200 | else if (circumflex && keys->circumflex(c)) | ||
201 | c = keys->circumflex(c); | ||
202 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | ||
203 | |||
204 | // the diaeresis key itself has to be in the diaeresisMap, | ||
205 | // or just do this to make it display the diaeresis char. | ||
206 | |||
207 | if (c == 0x2c6) | ||
208 | c = 0xa8; | ||
209 | else | ||
210 | c = keys->diaeresis(c); | ||
190 | } | 211 | } |
212 | |||
191 | p.drawText(x, y, | 213 | p.drawText(x, y, |
192 | defaultKeyWidth * keyWidth + 3, keyHeight, | 214 | defaultKeyWidth * keyWidth + 3, keyHeight, |
193 | AlignCenter, (QChar)c); | 215 | AlignCenter, (QChar)c); |
@@ -208,7 +230,7 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
208 | 230 | ||
209 | p.fillRect(0, 0, width(), height(), keycolor); | 231 | p.fillRect(0, 0, width(), height(), keycolor); |
210 | 232 | ||
211 | for (row = 1; row <= 5; row++) { | 233 | for (row = 1; row <= keys->rows(); row++) { |
212 | 234 | ||
213 | int x = 0; | 235 | int x = 0; |
214 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); | 236 | int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); |
@@ -233,9 +255,27 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
233 | p.setPen(textcolor); | 255 | p.setPen(textcolor); |
234 | if (!pix) { | 256 | if (!pix) { |
235 | if ((shift || lock) && keys->shift(c)) | 257 | if ((shift || lock) && keys->shift(c)) |
236 | c = keys->shift(c); | 258 | |
259 | if (circumflex && keys->circumflex(keys->shift(c))) | ||
260 | c = keys->circumflex(keys->shift(c)); | ||
261 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | ||
262 | c = keys->diaeresis(keys->shift(c)); | ||
263 | else if (meta && keys->meta(keys->shift(c))) | ||
264 | c = keys->meta(keys->shift(c)); | ||
265 | else | ||
266 | c = keys->shift(c); | ||
267 | |||
237 | else if (meta && keys->meta(c)) | 268 | else if (meta && keys->meta(c)) |
238 | c = keys->meta(c); | 269 | c = keys->meta(c); |
270 | else if (circumflex && keys->circumflex(c)) | ||
271 | c = keys->circumflex(c); | ||
272 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | ||
273 | |||
274 | if (c == 0x2c6) | ||
275 | c = 0xa8; | ||
276 | else | ||
277 | c = keys->diaeresis(c); | ||
278 | } | ||
239 | 279 | ||
240 | p.drawText(x, y, | 280 | p.drawText(x, y, |
241 | keyWidthPix + 3, keyHeight, | 281 | keyWidthPix + 3, keyHeight, |
@@ -289,11 +329,29 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
289 | // should be faster if just paint one key even though multiple keys exist. | 329 | // should be faster if just paint one key even though multiple keys exist. |
290 | bool need_repaint = FALSE; | 330 | bool need_repaint = FALSE; |
291 | 331 | ||
332 | // circumflex and diaeresis support | ||
333 | // messy to have this here, but too hard to implement any other method | ||
334 | if (unicode == 0x2c6) { | ||
335 | |||
336 | unicode = 0; | ||
337 | if (shift || lock) { | ||
338 | |||
339 | // diaeresis | ||
340 | qkeycode = 0x2001; | ||
341 | } | ||
342 | else { | ||
343 | |||
344 | // circumflex | ||
345 | qkeycode = 0x2000; | ||
346 | } | ||
347 | } | ||
348 | |||
292 | if (unicode == 0) { // either Qt char, or nothing | 349 | if (unicode == 0) { // either Qt char, or nothing |
293 | 350 | ||
294 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard | 351 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard |
295 | 352 | ||
296 | if ( configdlg ) { | 353 | if ( configdlg ) { |
354 | |||
297 | delete (ConfigDlg *) configdlg; | 355 | delete (ConfigDlg *) configdlg; |
298 | configdlg = 0; | 356 | configdlg = 0; |
299 | } | 357 | } |
@@ -309,6 +367,8 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
309 | this, SLOT(toggleRepeat(bool))); | 367 | this, SLOT(toggleRepeat(bool))); |
310 | connect(configdlg, SIGNAL(reloadKeyboard()), | 368 | connect(configdlg, SIGNAL(reloadKeyboard()), |
311 | this, SLOT(reloadKeyboard())); | 369 | this, SLOT(reloadKeyboard())); |
370 | connect(configdlg, SIGNAL(configDlgClosed()), | ||
371 | this, SLOT(cleanupConfigDlg())); | ||
312 | configdlg->showMaximized(); | 372 | configdlg->showMaximized(); |
313 | configdlg->show(); | 373 | configdlg->show(); |
314 | configdlg->raise(); | 374 | configdlg->raise(); |
@@ -359,11 +419,18 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
359 | lock = 0; | 419 | lock = 0; |
360 | } | 420 | } |
361 | } | 421 | } |
362 | if (meta) { | ||
363 | 422 | ||
364 | *meta = 0; | 423 | |
365 | meta = 0; | 424 | /* |
366 | } | 425 | * want to be able to hit circumflex/diaeresis -> shift |
426 | * to type in shifted circumflex/diaeresis chars. | ||
427 | * same thing with meta | ||
428 | |||
429 | if (meta) { *meta = 0; meta = 0; } | ||
430 | if (circumflex) { *circumflex = 0; circumflex = 0; } | ||
431 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | ||
432 | |||
433 | */ | ||
367 | 434 | ||
368 | } else if (qkeycode == Qt::Key_CapsLock) { | 435 | } else if (qkeycode == Qt::Key_CapsLock) { |
369 | need_repaint = TRUE; | 436 | need_repaint = TRUE; |
@@ -374,17 +441,18 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
374 | } | 441 | } |
375 | else { | 442 | else { |
376 | lock = keys->pressedPtr(row, col);; | 443 | lock = keys->pressedPtr(row, col);; |
377 | *lock = 1; | 444 | *lock = true;; |
378 | if (shift) { | 445 | if (shift) { |
379 | *shift = 0; | 446 | *shift = 0; |
380 | shift = 0; | 447 | shift = 0; |
381 | } | 448 | } |
382 | } | 449 | } |
383 | if (meta) { | ||
384 | 450 | ||
385 | *meta = 0; | 451 | /* |
386 | meta = 0; | 452 | if (meta) { *meta = 0; meta = 0; } |
387 | } | 453 | if (circumflex) { *circumflex = 0; circumflex = 0; } |
454 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | ||
455 | */ | ||
388 | 456 | ||
389 | } else if (qkeycode == Qt::Key_Meta) { | 457 | } else if (qkeycode == Qt::Key_Meta) { |
390 | need_repaint = TRUE; | 458 | need_repaint = TRUE; |
@@ -396,35 +464,121 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
396 | } else { | 464 | } else { |
397 | 465 | ||
398 | meta = keys->pressedPtr(row, col); | 466 | meta = keys->pressedPtr(row, col); |
399 | need_repaint = TRUE; | 467 | *meta = true; |
400 | *meta = !keys->pressed(row, col); | ||
401 | } | 468 | } |
402 | 469 | ||
403 | if (shift) { | 470 | // reset all the other keys |
471 | if (shift) { *shift = 0; shift = 0; } | ||
472 | if (lock) { *lock = 0; lock = 0; } | ||
473 | if (circumflex) { *circumflex = 0; circumflex = 0; } | ||
474 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | ||
404 | 475 | ||
405 | *shift = 0; | 476 | // dont need to emit this key... acts same as alt |
406 | shift = 0; | 477 | qkeycode = 0; |
478 | |||
479 | // circumflex | ||
480 | } else if (qkeycode == 0x2000) { | ||
481 | need_repaint = TRUE; | ||
482 | |||
483 | if (circumflex) { | ||
484 | |||
485 | *circumflex = 0; | ||
486 | circumflex = 0; | ||
487 | |||
488 | } else { | ||
407 | 489 | ||
490 | circumflex = keys->pressedPtr(row, col); | ||
491 | *circumflex = true; | ||
408 | } | 492 | } |
409 | if (lock) { | ||
410 | 493 | ||
411 | *lock = 0; | 494 | /* no need to turn off shift or lock if circumflex |
412 | lock = 0; | 495 | * keys are pressed |
496 | |||
497 | if (shift) { *shift = 0; shift = 0; } | ||
498 | if (lock) { *lock = 0; lock = 0; } | ||
499 | |||
500 | */ | ||
501 | |||
502 | // have to reset all the other keys | ||
503 | if (meta) { *meta = 0; meta = 0; } | ||
504 | if (diaeresis) { | ||
505 | |||
506 | // *diaeresis and *circumflex point to the same thing | ||
507 | // when diaeresis is enabled and you hit the circumflex | ||
508 | // since they are the same key, it should turn off the | ||
509 | // key | ||
510 | |||
511 | *diaeresis = 0; | ||
512 | diaeresis = 0; | ||
513 | circumflex = 0; | ||
514 | } | ||
515 | |||
516 | qkeycode = 0; | ||
413 | 517 | ||
518 | // diaeresis | ||
519 | } else if (qkeycode == 0x2001) { | ||
520 | need_repaint = TRUE; | ||
521 | |||
522 | if (diaeresis) { | ||
523 | |||
524 | *diaeresis = 0; | ||
525 | diaeresis = 0; | ||
526 | |||
527 | } else { | ||
528 | |||
529 | diaeresis = keys->pressedPtr(row, col); | ||
530 | *diaeresis = true; | ||
414 | } | 531 | } |
415 | 532 | ||
416 | // dont need to emit this key... acts same as alt | 533 | |
534 | if (shift) { *shift = 0; shift = 0; } | ||
535 | |||
536 | /* | ||
537 | * | ||
538 | if (lock) { *lock = 0; lock = 0; } | ||
539 | * | ||
540 | */ | ||
541 | |||
542 | if (meta) { *meta = 0; meta = 0; } | ||
543 | if (circumflex) { | ||
544 | |||
545 | // *circumflex = 0; | ||
546 | // | ||
547 | // same thing the diaeresis pointer points too | ||
548 | |||
549 | circumflex = 0; | ||
550 | } | ||
551 | |||
552 | |||
417 | qkeycode = 0; | 553 | qkeycode = 0; |
418 | } | 554 | } |
419 | 555 | ||
420 | } | 556 | } |
421 | else { // normal char | 557 | else { // normal char |
422 | if ((shift || lock) && keys->shift(unicode)) { | 558 | if ((shift || lock) && keys->shift(unicode)) { |
423 | unicode = keys->shift(unicode); | 559 | |
560 | // make diaeresis/circumflex -> shift input shifted | ||
561 | // diaeresis/circumflex chars | ||
562 | |||
563 | if (circumflex && keys->circumflex(keys->shift(unicode))) | ||
564 | unicode = keys->circumflex(keys->shift(unicode)); | ||
565 | else if (diaeresis && keys->diaeresis(keys->shift(unicode))) | ||
566 | unicode = keys->diaeresis(keys->shift(unicode)); | ||
567 | else if (meta && keys->meta(keys->shift(unicode))) | ||
568 | unicode = keys->meta(keys->shift(unicode)); | ||
569 | else | ||
570 | unicode = keys->shift(unicode); | ||
424 | } | 571 | } |
425 | if (meta && keys->meta(unicode)) { | 572 | else if (meta && keys->meta(unicode)) { |
426 | unicode = keys->meta(unicode); | 573 | unicode = keys->meta(unicode); |
427 | } | 574 | } |
575 | else if (circumflex && keys->circumflex(unicode)) { | ||
576 | unicode = keys->circumflex(unicode); | ||
577 | } | ||
578 | else if (diaeresis && keys->diaeresis(unicode)) { | ||
579 | |||
580 | unicode = keys->diaeresis(unicode); | ||
581 | } | ||
428 | } | 582 | } |
429 | 583 | ||
430 | // korean parsing | 584 | // korean parsing |
@@ -504,15 +658,22 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*) | |||
504 | shift = 0; // reset the shift pointer | 658 | shift = 0; // reset the shift pointer |
505 | repaint(FALSE); | 659 | repaint(FALSE); |
506 | 660 | ||
507 | } else if (meta && unicode != 0) { | 661 | } |
662 | |||
663 | /* | ||
664 | * do not make the meta key release after being pressed | ||
665 | * | ||
666 | |||
667 | else if (meta && unicode != 0) { | ||
508 | 668 | ||
509 | *meta = 0; | 669 | *meta = 0; |
510 | meta = 0; | 670 | meta = 0; |
511 | repaint(FALSE); | 671 | repaint(FALSE); |
512 | } | 672 | } |
513 | else | ||
514 | 673 | ||
515 | clearHighlight(); | 674 | */ |
675 | |||
676 | else clearHighlight(); | ||
516 | } | 677 | } |
517 | 678 | ||
518 | /* Keyboard::timerEvent {{{1 */ | 679 | /* Keyboard::timerEvent {{{1 */ |
@@ -561,12 +722,18 @@ QSize Keyboard::sizeHint() const | |||
561 | QFontMetrics fm=fontMetrics(); | 722 | QFontMetrics fm=fontMetrics(); |
562 | int keyHeight = fm.lineSpacing() + 2; | 723 | int keyHeight = fm.lineSpacing() + 2; |
563 | 724 | ||
564 | return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); | 725 | return QSize( 240, keyHeight * keys->rows() + (usePicks ? picks->sizeHint().height() : 0) + 1); |
565 | } | 726 | } |
566 | 727 | ||
567 | 728 | ||
568 | void Keyboard::resetState() | 729 | void Keyboard::resetState() |
569 | { | 730 | { |
731 | if (shift) { *shift = 0; shift = 0; } | ||
732 | if (lock) {*lock = 0; lock = 0; } | ||
733 | if (meta) { *meta = 0; meta = 0; } | ||
734 | if (circumflex) { *circumflex = 0; circumflex = 0; } | ||
735 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | ||
736 | |||
570 | schar = mchar = echar = 0; | 737 | schar = mchar = echar = 0; |
571 | picks->resetState(); | 738 | picks->resetState(); |
572 | } | 739 | } |
@@ -604,6 +771,14 @@ void Keyboard::toggleRepeat(bool on) { | |||
604 | //cout << "setting useRepeat to: " << useRepeat << "\n"; | 771 | //cout << "setting useRepeat to: " << useRepeat << "\n"; |
605 | } | 772 | } |
606 | 773 | ||
774 | void Keyboard::cleanupConfigDlg() { | ||
775 | |||
776 | if ( configdlg ) { | ||
777 | delete (ConfigDlg *) configdlg; | ||
778 | configdlg = 0; | ||
779 | } | ||
780 | } | ||
781 | |||
607 | /* Keyboard::setMapTo ... {{{1 */ | 782 | /* Keyboard::setMapTo ... {{{1 */ |
608 | void Keyboard::setMapToDefault() { | 783 | void Keyboard::setMapToDefault() { |
609 | 784 | ||
@@ -614,7 +789,7 @@ void Keyboard::setMapToDefault() { | |||
614 | QString l = config->readEntry( "Language" , "en" ); | 789 | QString l = config->readEntry( "Language" , "en" ); |
615 | delete config; | 790 | delete config; |
616 | 791 | ||
617 | QString key_map = QPEApplication::qpeDir() + "/share/multikey/" | 792 | QString key_map = QPEApplication::qpeDir() + "share/multikey/" |
618 | + l + ".keymap"; | 793 | + l + ".keymap"; |
619 | 794 | ||
620 | /* save change to multikey config file */ | 795 | /* save change to multikey config file */ |
@@ -623,11 +798,20 @@ void Keyboard::setMapToDefault() { | |||
623 | config->writeEntry ("current", key_map); // default closed | 798 | config->writeEntry ("current", key_map); // default closed |
624 | delete config; | 799 | delete config; |
625 | 800 | ||
801 | int prevRows = keys->rows(); | ||
802 | |||
626 | delete keys; | 803 | delete keys; |
627 | keys = new Keys(key_map); | 804 | keys = new Keys(key_map); |
628 | 805 | ||
629 | // have to repaint the keyboard | 806 | // have to repaint the keyboard |
630 | repaint(FALSE); | 807 | if (prevRows != keys->rows()) { |
808 | |||
809 | QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); | ||
810 | QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); | ||
811 | |||
812 | } else repaint(FALSE); | ||
813 | |||
814 | resetState(); | ||
631 | } | 815 | } |
632 | 816 | ||
633 | void Keyboard::setMapToFile(QString map) { | 817 | void Keyboard::setMapToFile(QString map) { |
@@ -639,14 +823,22 @@ void Keyboard::setMapToFile(QString map) { | |||
639 | 823 | ||
640 | delete config; | 824 | delete config; |
641 | 825 | ||
826 | int prevRows = keys->rows(); | ||
827 | |||
642 | delete keys; | 828 | delete keys; |
643 | if (QFile(map).exists()) | 829 | if (QFile(map).exists()) |
644 | keys = new Keys(map); | 830 | keys = new Keys(map); |
645 | else | 831 | else |
646 | keys = new Keys(); | 832 | keys = new Keys(); |
647 | 833 | ||
648 | repaint(FALSE); | 834 | if (keys->rows() != prevRows) { |
835 | |||
836 | QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); | ||
837 | QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); | ||
838 | } | ||
839 | else repaint(FALSE); | ||
649 | 840 | ||
841 | resetState(); | ||
650 | } | 842 | } |
651 | 843 | ||
652 | /* Keybaord::reloadKeyboard {{{1 */ | 844 | /* Keybaord::reloadKeyboard {{{1 */ |
@@ -1124,6 +1316,31 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1124 | buf = t.readLine(); | 1316 | buf = t.readLine(); |
1125 | } | 1317 | } |
1126 | 1318 | ||
1319 | // circumflex | ||
1320 | else if (buf.contains(QRegExp("^\\s*c\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | ||
1321 | |||
1322 | QTextStream tmp (buf, IO_ReadOnly); | ||
1323 | ushort lower, shift; | ||
1324 | QChar c; | ||
1325 | tmp >> c >> lower >> shift; | ||
1326 | |||
1327 | circumflexMap.insert(lower, shift); | ||
1328 | |||
1329 | buf = t.readLine(); | ||
1330 | } | ||
1331 | // diaeresis | ||
1332 | else if (buf.contains(QRegExp("^\\s*d\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | ||
1333 | |||
1334 | QTextStream tmp (buf, IO_ReadOnly); | ||
1335 | ushort lower, shift; | ||
1336 | QChar d; | ||
1337 | tmp >> d >> lower >> shift; | ||
1338 | |||
1339 | diaeresisMap.insert(lower, shift); | ||
1340 | |||
1341 | buf = t.readLine(); | ||
1342 | } | ||
1343 | |||
1127 | // other variables like lang & title | 1344 | // other variables like lang & title |
1128 | else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { | 1345 | else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { |
1129 | 1346 | ||
@@ -1205,6 +1422,18 @@ int Keys::width(const int row, const int col) { | |||
1205 | return keys[row].at(col)->width; | 1422 | return keys[row].at(col)->width; |
1206 | 1423 | ||
1207 | } | 1424 | } |
1425 | |||
1426 | int Keys::rows() { | ||
1427 | |||
1428 | for (int i = 1; i <= 5; i++) { | ||
1429 | |||
1430 | if (keys[i].count() == 0) | ||
1431 | return i - 1; | ||
1432 | |||
1433 | } | ||
1434 | return 5; | ||
1435 | } | ||
1436 | |||
1208 | ushort Keys::uni(const int row, const int col) { | 1437 | ushort Keys::uni(const int row, const int col) { |
1209 | 1438 | ||
1210 | return keys[row].at(col)->unicode; | 1439 | return keys[row].at(col)->unicode; |
@@ -1238,24 +1467,26 @@ void Keys::setPressed(const int row, const int col, const bool pressed) { | |||
1238 | 1467 | ||
1239 | ushort Keys::shift(const ushort uni) { | 1468 | ushort Keys::shift(const ushort uni) { |
1240 | 1469 | ||
1241 | if (shiftMap[uni]) { | 1470 | if (shiftMap[uni]) return shiftMap[uni]; |
1471 | else return 0; | ||
1472 | } | ||
1242 | 1473 | ||
1243 | return shiftMap[uni]; | 1474 | ushort Keys::meta(const ushort uni) { |
1244 | } | ||
1245 | else | ||
1246 | return 0; | ||
1247 | 1475 | ||
1476 | if (metaMap[uni]) return metaMap[uni]; | ||
1477 | else return 0; | ||
1248 | } | 1478 | } |
1249 | 1479 | ||
1250 | ushort Keys::meta(const ushort uni) { | 1480 | ushort Keys::circumflex(const ushort uni) { |
1251 | 1481 | ||
1252 | if (metaMap[uni]) { | 1482 | if (circumflexMap[uni]) return circumflexMap[uni]; |
1483 | else return 0; | ||
1484 | } | ||
1253 | 1485 | ||
1254 | return metaMap[uni]; | 1486 | ushort Keys::diaeresis(const ushort uni) { |
1255 | } | ||
1256 | else | ||
1257 | return 0; | ||
1258 | 1487 | ||
1488 | if(diaeresisMap[uni]) return diaeresisMap[uni]; | ||
1489 | else return 0; | ||
1259 | } | 1490 | } |
1260 | 1491 | ||
1261 | bool *Keys::pressedPtr(const int row, const int col) { | 1492 | bool *Keys::pressedPtr(const int row, const int col) { |
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index 1aa7a35..8af80d0 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -56,13 +56,16 @@ public: | |||
56 | Keys(); | 56 | Keys(); |
57 | Keys(const char * filename); | 57 | Keys(const char * filename); |
58 | ~Keys(); | 58 | ~Keys(); |
59 | int width(const int row, const int col); | ||
60 | int rows(); | ||
59 | ushort uni(const int row, const int col); | 61 | ushort uni(const int row, const int col); |
60 | int qcode(const int row, const int col); | 62 | int qcode(const int row, const int col); |
61 | int width(const int row, const int col); | ||
62 | bool pressed(const int row, const int col); | 63 | bool pressed(const int row, const int col); |
63 | bool *pressedPtr(const int row, const int col); | 64 | bool *pressedPtr(const int row, const int col); |
64 | ushort shift(const ushort); | 65 | ushort shift(const ushort); |
65 | ushort meta(const ushort); | 66 | ushort meta(const ushort); |
67 | ushort circumflex(const ushort); | ||
68 | ushort diaeresis(const ushort); | ||
66 | QImage *pix(const int row, const int col); | 69 | QImage *pix(const int row, const int col); |
67 | int numKeys(const int row); | 70 | int numKeys(const int row); |
68 | void setKeysFromFile(const char *filename); | 71 | void setKeysFromFile(const char *filename); |
@@ -87,6 +90,8 @@ private: | |||
87 | QList<Key> keys[6]; | 90 | QList<Key> keys[6]; |
88 | QMap<ushort,ushort> shiftMap; | 91 | QMap<ushort,ushort> shiftMap; |
89 | QMap<ushort,ushort> metaMap; | 92 | QMap<ushort,ushort> metaMap; |
93 | QMap<ushort,ushort> circumflexMap; | ||
94 | QMap<ushort,ushort> diaeresisMap; | ||
90 | 95 | ||
91 | }; | 96 | }; |
92 | 97 | ||
@@ -117,6 +122,7 @@ private slots: | |||
117 | void toggleRepeat(bool on_off); | 122 | void toggleRepeat(bool on_off); |
118 | void setMapToDefault(); | 123 | void setMapToDefault(); |
119 | void setMapToFile(QString map); | 124 | void setMapToFile(QString map); |
125 | void cleanupConfigDlg(); | ||
120 | 126 | ||
121 | // used to redraw keyboard after edited colors | 127 | // used to redraw keyboard after edited colors |
122 | void reloadKeyboard(); | 128 | void reloadKeyboard(); |
@@ -130,6 +136,9 @@ private: | |||
130 | bool *ctrl; | 136 | bool *ctrl; |
131 | bool *alt; | 137 | bool *alt; |
132 | bool *meta; | 138 | bool *meta; |
139 | bool *circumflex; | ||
140 | bool *diaeresis; | ||
141 | |||
133 | uint useLargeKeys:1; | 142 | uint useLargeKeys:1; |
134 | uint usePicks:1; | 143 | uint usePicks:1; |
135 | uint useRepeat:1; | 144 | uint useRepeat:1; |