-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 148 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.h | 6 |
2 files changed, 153 insertions, 1 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 28d5cab..1dd8ca1 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -32,25 +32,25 @@ | |||
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <ctype.h> | 33 | #include <ctype.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | 37 | ||
38 | #include <sys/utsname.h> | 38 | #include <sys/utsname.h> |
39 | 39 | ||
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), | 43 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), |
44 | meta(0), circumflex(0), diaeresis(0), | 44 | meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), |
45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), | 45 | useLargeKeys(TRUE), usePicks(0), useRepeat(0), |
46 | pressedKeyRow(-1), pressedKeyCol(-1), | 46 | pressedKeyRow(-1), pressedKeyCol(-1), |
47 | 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), |
48 | configdlg(0) | 48 | configdlg(0) |
49 | 49 | ||
50 | { | 50 | { |
51 | 51 | ||
52 | // get the default font | 52 | // get the default font |
53 | Config *config = new Config( "qpe" ); | 53 | Config *config = new Config( "qpe" ); |
54 | config->setGroup( "Appearance" ); | 54 | config->setGroup( "Appearance" ); |
55 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); | 55 | QString familyStr = config->readEntry( "FontFamily", "fixed" ); |
56 | delete config; | 56 | delete config; |
@@ -181,33 +181,41 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
181 | QImage *pix = keys->pix(row,col); | 181 | QImage *pix = keys->pix(row,col); |
182 | 182 | ||
183 | ushort c = keys->uni(row, col); | 183 | ushort c = keys->uni(row, col); |
184 | 184 | ||
185 | p.setPen(textcolor); | 185 | p.setPen(textcolor); |
186 | if (!pix) { | 186 | if (!pix) { |
187 | if ((shift || lock) && keys->shift(c)) | 187 | if ((shift || lock) && keys->shift(c)) |
188 | 188 | ||
189 | if (circumflex && keys->circumflex(keys->shift(c))) | 189 | if (circumflex && keys->circumflex(keys->shift(c))) |
190 | c = keys->circumflex(keys->shift(c)); | 190 | c = keys->circumflex(keys->shift(c)); |
191 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | 191 | else if (diaeresis && keys->diaeresis(keys->shift(c))) |
192 | c = keys->diaeresis(keys->shift(c)); | 192 | c = keys->diaeresis(keys->shift(c)); |
193 | else if (baccent && keys->baccent(keys->shift(c))) | ||
194 | c = keys->baccent(keys->shift(c)); | ||
195 | else if (accent && keys->accent(keys->shift(c))) | ||
196 | c = keys->accent(keys->shift(c)); | ||
193 | else if (meta && keys->meta(keys->shift(c))) | 197 | else if (meta && keys->meta(keys->shift(c))) |
194 | c = keys->meta(keys->shift(c)); | 198 | c = keys->meta(keys->shift(c)); |
195 | else | 199 | else |
196 | c = keys->shift(c); | 200 | c = keys->shift(c); |
197 | 201 | ||
198 | else if (meta && keys->meta(c)) | 202 | else if (meta && keys->meta(c)) |
199 | c = keys->meta(c); | 203 | c = keys->meta(c); |
200 | else if (circumflex && keys->circumflex(c)) | 204 | else if (circumflex && keys->circumflex(c)) |
201 | c = keys->circumflex(c); | 205 | c = keys->circumflex(c); |
206 | else if (baccent && keys->baccent(c)) | ||
207 | c = keys->baccent(c); | ||
208 | else if (accent && keys->accent(c)) | ||
209 | c = keys->accent(c); | ||
202 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | 210 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { |
203 | 211 | ||
204 | // the diaeresis key itself has to be in the diaeresisMap, | 212 | // the diaeresis key itself has to be in the diaeresisMap, |
205 | // or just do this to make it display the diaeresis char. | 213 | // or just do this to make it display the diaeresis char. |
206 | 214 | ||
207 | if (c == 0x2c6) | 215 | if (c == 0x2c6) |
208 | c = 0xa8; | 216 | c = 0xa8; |
209 | else | 217 | else |
210 | c = keys->diaeresis(c); | 218 | c = keys->diaeresis(c); |
211 | } | 219 | } |
212 | 220 | ||
213 | p.drawText(x, y, | 221 | p.drawText(x, y, |
@@ -251,33 +259,41 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
251 | keyHeight - 1, keycolor_pressed); | 259 | keyHeight - 1, keycolor_pressed); |
252 | 260 | ||
253 | ushort c = keys->uni(row, col); | 261 | ushort c = keys->uni(row, col); |
254 | 262 | ||
255 | p.setPen(textcolor); | 263 | p.setPen(textcolor); |
256 | if (!pix) { | 264 | if (!pix) { |
257 | if ((shift || lock) && keys->shift(c)) | 265 | if ((shift || lock) && keys->shift(c)) |
258 | 266 | ||
259 | if (circumflex && keys->circumflex(keys->shift(c))) | 267 | if (circumflex && keys->circumflex(keys->shift(c))) |
260 | c = keys->circumflex(keys->shift(c)); | 268 | c = keys->circumflex(keys->shift(c)); |
261 | else if (diaeresis && keys->diaeresis(keys->shift(c))) | 269 | else if (diaeresis && keys->diaeresis(keys->shift(c))) |
262 | c = keys->diaeresis(keys->shift(c)); | 270 | c = keys->diaeresis(keys->shift(c)); |
271 | else if (baccent && keys->baccent(keys->shift(c))) | ||
272 | c = keys->baccent(keys->shift(c)); | ||
273 | else if (accent && keys->accent(keys->shift(c))) | ||
274 | c = keys->accent(keys->shift(c)); | ||
263 | else if (meta && keys->meta(keys->shift(c))) | 275 | else if (meta && keys->meta(keys->shift(c))) |
264 | c = keys->meta(keys->shift(c)); | 276 | c = keys->meta(keys->shift(c)); |
265 | else | 277 | else |
266 | c = keys->shift(c); | 278 | c = keys->shift(c); |
267 | 279 | ||
268 | else if (meta && keys->meta(c)) | 280 | else if (meta && keys->meta(c)) |
269 | c = keys->meta(c); | 281 | c = keys->meta(c); |
270 | else if (circumflex && keys->circumflex(c)) | 282 | else if (circumflex && keys->circumflex(c)) |
271 | c = keys->circumflex(c); | 283 | c = keys->circumflex(c); |
284 | else if (baccent && keys->baccent(c)) | ||
285 | c = keys->baccent(c); | ||
286 | else if (accent && keys->accent(c)) | ||
287 | c = keys->accent(c); | ||
272 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { | 288 | else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { |
273 | 289 | ||
274 | if (c == 0x2c6) | 290 | if (c == 0x2c6) |
275 | c = 0xa8; | 291 | c = 0xa8; |
276 | else | 292 | else |
277 | c = keys->diaeresis(c); | 293 | c = keys->diaeresis(c); |
278 | } | 294 | } |
279 | 295 | ||
280 | p.drawText(x, y, | 296 | p.drawText(x, y, |
281 | keyWidthPix + 3, keyHeight, | 297 | keyWidthPix + 3, keyHeight, |
282 | AlignCenter, (QChar)c); | 298 | AlignCenter, (QChar)c); |
283 | } | 299 | } |
@@ -337,24 +353,59 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
337 | if (shift || lock) { | 353 | if (shift || lock) { |
338 | 354 | ||
339 | // diaeresis | 355 | // diaeresis |
340 | qkeycode = 0x2001; | 356 | qkeycode = 0x2001; |
341 | } | 357 | } |
342 | else { | 358 | else { |
343 | 359 | ||
344 | // circumflex | 360 | // circumflex |
345 | qkeycode = 0x2000; | 361 | qkeycode = 0x2000; |
346 | } | 362 | } |
347 | } | 363 | } |
348 | 364 | ||
365 | // Back accent character support | ||
366 | |||
367 | if (unicode == 0x60) { | ||
368 | |||
369 | unicode = 0; | ||
370 | if (shift || lock) { | ||
371 | |||
372 | // circumblex | ||
373 | qkeycode = 0x2000; | ||
374 | } | ||
375 | else { | ||
376 | |||
377 | // back accent | ||
378 | qkeycode = 0x2002; | ||
379 | } | ||
380 | } | ||
381 | |||
382 | // Accent character support | ||
383 | |||
384 | if (unicode == 0xb4) { | ||
385 | |||
386 | unicode = 0; | ||
387 | if (shift || lock) { | ||
388 | |||
389 | // diaeresis | ||
390 | qkeycode = 0x2001; | ||
391 | } | ||
392 | else { | ||
393 | |||
394 | // accent | ||
395 | qkeycode = 0x2003; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | |||
349 | if (unicode == 0) { // either Qt char, or nothing | 400 | if (unicode == 0) { // either Qt char, or nothing |
350 | 401 | ||
351 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard | 402 | if (qkeycode == Qt::Key_F1) { // toggle the pickboard |
352 | 403 | ||
353 | if ( configdlg ) { | 404 | if ( configdlg ) { |
354 | 405 | ||
355 | delete (ConfigDlg *) configdlg; | 406 | delete (ConfigDlg *) configdlg; |
356 | configdlg = 0; | 407 | configdlg = 0; |
357 | } | 408 | } |
358 | else { | 409 | else { |
359 | configdlg = new ConfigDlg (); | 410 | configdlg = new ConfigDlg (); |
360 | connect(configdlg, SIGNAL(setMapToDefault()), | 411 | connect(configdlg, SIGNAL(setMapToDefault()), |
@@ -463,24 +514,26 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
463 | 514 | ||
464 | } else { | 515 | } else { |
465 | 516 | ||
466 | meta = keys->pressedPtr(row, col); | 517 | meta = keys->pressedPtr(row, col); |
467 | *meta = true; | 518 | *meta = true; |
468 | } | 519 | } |
469 | 520 | ||
470 | // reset all the other keys | 521 | // reset all the other keys |
471 | if (shift) { *shift = 0; shift = 0; } | 522 | if (shift) { *shift = 0; shift = 0; } |
472 | if (lock) { *lock = 0; lock = 0; } | 523 | if (lock) { *lock = 0; lock = 0; } |
473 | if (circumflex) { *circumflex = 0; circumflex = 0; } | 524 | if (circumflex) { *circumflex = 0; circumflex = 0; } |
474 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | 525 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } |
526 | if (baccent) { *baccent = 0; baccent = 0; } | ||
527 | if (accent) { *accent = 0; accent = 0; } | ||
475 | 528 | ||
476 | // dont need to emit this key... acts same as alt | 529 | // dont need to emit this key... acts same as alt |
477 | qkeycode = 0; | 530 | qkeycode = 0; |
478 | 531 | ||
479 | // circumflex | 532 | // circumflex |
480 | } else if (qkeycode == 0x2000) { | 533 | } else if (qkeycode == 0x2000) { |
481 | need_repaint = TRUE; | 534 | need_repaint = TRUE; |
482 | 535 | ||
483 | if (circumflex) { | 536 | if (circumflex) { |
484 | 537 | ||
485 | *circumflex = 0; | 538 | *circumflex = 0; |
486 | circumflex = 0; | 539 | circumflex = 0; |
@@ -542,52 +595,106 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
542 | if (meta) { *meta = 0; meta = 0; } | 595 | if (meta) { *meta = 0; meta = 0; } |
543 | if (circumflex) { | 596 | if (circumflex) { |
544 | 597 | ||
545 | // *circumflex = 0; | 598 | // *circumflex = 0; |
546 | // | 599 | // |
547 | // same thing the diaeresis pointer points too | 600 | // same thing the diaeresis pointer points too |
548 | 601 | ||
549 | circumflex = 0; | 602 | circumflex = 0; |
550 | } | 603 | } |
551 | 604 | ||
552 | 605 | ||
553 | qkeycode = 0; | 606 | qkeycode = 0; |
607 | |||
608 | // Back accent | ||
609 | } else if (qkeycode == 0x2002) { | ||
610 | need_repaint = TRUE; | ||
611 | |||
612 | if (baccent) { | ||
613 | |||
614 | *baccent = 0; | ||
615 | baccent = 0; | ||
616 | |||
617 | } else { | ||
618 | |||
619 | baccent = keys->pressedPtr(row, col); | ||
620 | *baccent = true; | ||
621 | } | ||
622 | |||
623 | |||
624 | if (shift) { *shift = 0; shift = 0; } | ||
625 | if (meta) { *meta = 0; meta = 0; } | ||
626 | if (accent) { *accent = 0; accent = 0; } | ||
627 | |||
628 | qkeycode = 0; | ||
629 | |||
630 | // Accent | ||
631 | } else if (qkeycode == 0x2003) { | ||
632 | need_repaint = TRUE; | ||
633 | |||
634 | if (accent) { | ||
635 | |||
636 | *accent = 0; | ||
637 | accent = 0; | ||
638 | |||
639 | } else { | ||
640 | |||
641 | accent = keys->pressedPtr(row, col); | ||
642 | *accent = true; | ||
643 | } | ||
644 | |||
645 | |||
646 | if (shift) { *shift = 0; shift = 0; } | ||
647 | if (meta) { *meta = 0; meta = 0; } | ||
648 | if (baccent) { *baccent = 0; } | ||
649 | |||
650 | qkeycode = 0; | ||
554 | } | 651 | } |
555 | 652 | ||
556 | } | 653 | } |
557 | else { // normal char | 654 | else { // normal char |
558 | if ((shift || lock) && keys->shift(unicode)) { | 655 | if ((shift || lock) && keys->shift(unicode)) { |
559 | 656 | ||
560 | // make diaeresis/circumflex -> shift input shifted | 657 | // make diaeresis/circumflex -> shift input shifted |
561 | // diaeresis/circumflex chars | 658 | // diaeresis/circumflex chars |
562 | 659 | ||
563 | if (circumflex && keys->circumflex(keys->shift(unicode))) | 660 | if (circumflex && keys->circumflex(keys->shift(unicode))) |
564 | unicode = keys->circumflex(keys->shift(unicode)); | 661 | unicode = keys->circumflex(keys->shift(unicode)); |
565 | else if (diaeresis && keys->diaeresis(keys->shift(unicode))) | 662 | else if (diaeresis && keys->diaeresis(keys->shift(unicode))) |
566 | unicode = keys->diaeresis(keys->shift(unicode)); | 663 | unicode = keys->diaeresis(keys->shift(unicode)); |
664 | else if (baccent && keys->baccent(keys->shift(unicode))) | ||
665 | unicode = keys->baccent(keys->shift(unicode)); | ||
666 | else if (accent && keys->accent(keys->shift(unicode))) | ||
667 | unicode = keys->accent(keys->shift(unicode)); | ||
567 | else if (meta && keys->meta(keys->shift(unicode))) | 668 | else if (meta && keys->meta(keys->shift(unicode))) |
568 | unicode = keys->meta(keys->shift(unicode)); | 669 | unicode = keys->meta(keys->shift(unicode)); |
569 | else | 670 | else |
570 | unicode = keys->shift(unicode); | 671 | unicode = keys->shift(unicode); |
571 | } | 672 | } |
572 | else if (meta && keys->meta(unicode)) { | 673 | else if (meta && keys->meta(unicode)) { |
573 | unicode = keys->meta(unicode); | 674 | unicode = keys->meta(unicode); |
574 | } | 675 | } |
575 | else if (circumflex && keys->circumflex(unicode)) { | 676 | else if (circumflex && keys->circumflex(unicode)) { |
576 | unicode = keys->circumflex(unicode); | 677 | unicode = keys->circumflex(unicode); |
577 | } | 678 | } |
578 | else if (diaeresis && keys->diaeresis(unicode)) { | 679 | else if (diaeresis && keys->diaeresis(unicode)) { |
579 | 680 | ||
580 | unicode = keys->diaeresis(unicode); | 681 | unicode = keys->diaeresis(unicode); |
581 | } | 682 | } |
683 | else if (baccent && keys->baccent(unicode)) { | ||
684 | unicode = keys->baccent(unicode); | ||
685 | } | ||
686 | else if (accent && keys->accent(unicode)) { | ||
687 | unicode = keys->accent(unicode); | ||
688 | } | ||
582 | } | 689 | } |
583 | 690 | ||
584 | // korean parsing | 691 | // korean parsing |
585 | if (keys->lang == "ko") { | 692 | if (keys->lang == "ko") { |
586 | 693 | ||
587 | unicode = parseKoreanInput(unicode); | 694 | unicode = parseKoreanInput(unicode); |
588 | } | 695 | } |
589 | 696 | ||
590 | modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); | 697 | modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); |
591 | 698 | ||
592 | if ('A' <= unicode && unicode <= 'z' && modifiers) { | 699 | if ('A' <= unicode && unicode <= 'z' && modifiers) { |
593 | 700 | ||
@@ -724,24 +831,26 @@ QSize Keyboard::sizeHint() const | |||
724 | 831 | ||
725 | return QSize( 240, keyHeight * keys->rows() + (usePicks ? picks->sizeHint().height() : 0) + 1); | 832 | return QSize( 240, keyHeight * keys->rows() + (usePicks ? picks->sizeHint().height() : 0) + 1); |
726 | } | 833 | } |
727 | 834 | ||
728 | 835 | ||
729 | void Keyboard::resetState() | 836 | void Keyboard::resetState() |
730 | { | 837 | { |
731 | if (shift) { *shift = 0; shift = 0; } | 838 | if (shift) { *shift = 0; shift = 0; } |
732 | if (lock) {*lock = 0; lock = 0; } | 839 | if (lock) {*lock = 0; lock = 0; } |
733 | if (meta) { *meta = 0; meta = 0; } | 840 | if (meta) { *meta = 0; meta = 0; } |
734 | if (circumflex) { *circumflex = 0; circumflex = 0; } | 841 | if (circumflex) { *circumflex = 0; circumflex = 0; } |
735 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } | 842 | if (diaeresis) { *diaeresis = 0; diaeresis = 0; } |
843 | if (baccent) { *baccent = 0; baccent = 0; } | ||
844 | if (accent) { *accent = 0; accent = 0; } | ||
736 | 845 | ||
737 | schar = mchar = echar = 0; | 846 | schar = mchar = echar = 0; |
738 | picks->resetState(); | 847 | picks->resetState(); |
739 | } | 848 | } |
740 | 849 | ||
741 | /* Keyboard::togglePickboard {{{1 */ | 850 | /* Keyboard::togglePickboard {{{1 */ |
742 | void Keyboard::togglePickboard(bool on_off) | 851 | void Keyboard::togglePickboard(bool on_off) |
743 | { | 852 | { |
744 | usePicks = on_off; | 853 | usePicks = on_off; |
745 | if (usePicks) { | 854 | if (usePicks) { |
746 | picks->show(); | 855 | picks->show(); |
747 | //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send | 856 | //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send |
@@ -1331,24 +1440,49 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1331 | // diaeresis | 1440 | // diaeresis |
1332 | else if (buf.contains(QRegExp("^\\s*d\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | 1441 | else if (buf.contains(QRegExp("^\\s*d\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { |
1333 | 1442 | ||
1334 | QTextStream tmp (buf, IO_ReadOnly); | 1443 | QTextStream tmp (buf, IO_ReadOnly); |
1335 | ushort lower, shift; | 1444 | ushort lower, shift; |
1336 | QChar d; | 1445 | QChar d; |
1337 | tmp >> d >> lower >> shift; | 1446 | tmp >> d >> lower >> shift; |
1338 | 1447 | ||
1339 | diaeresisMap.insert(lower, shift); | 1448 | diaeresisMap.insert(lower, shift); |
1340 | 1449 | ||
1341 | buf = t.readLine(); | 1450 | buf = t.readLine(); |
1342 | } | 1451 | } |
1452 | // back accent | ||
1453 | else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | ||
1454 | |||
1455 | QTextStream tmp (buf, IO_ReadOnly); | ||
1456 | ushort lower, shift; | ||
1457 | QChar d; | ||
1458 | tmp >> d >> lower >> shift; | ||
1459 | |||
1460 | baccentMap.insert(lower, shift); | ||
1461 | |||
1462 | qDebug ("Estoy añadiendo %i con %i", lower, shift); | ||
1463 | buf = t.readLine(); | ||
1464 | } | ||
1465 | // accent | ||
1466 | else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | ||
1467 | |||
1468 | QTextStream tmp (buf, IO_ReadOnly); | ||
1469 | ushort lower, shift; | ||
1470 | QChar d; | ||
1471 | tmp >> d >> lower >> shift; | ||
1472 | |||
1473 | accentMap.insert(lower, shift); | ||
1474 | |||
1475 | buf = t.readLine(); | ||
1476 | } | ||
1343 | 1477 | ||
1344 | // other variables like lang & title | 1478 | // other variables like lang & title |
1345 | else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { | 1479 | else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { |
1346 | 1480 | ||
1347 | QTextStream tmp (buf, IO_ReadOnly); | 1481 | QTextStream tmp (buf, IO_ReadOnly); |
1348 | QString name, equals, value; | 1482 | QString name, equals, value; |
1349 | 1483 | ||
1350 | tmp >> name >> equals >> value; | 1484 | tmp >> name >> equals >> value; |
1351 | 1485 | ||
1352 | if (name == "lang") { | 1486 | if (name == "lang") { |
1353 | 1487 | ||
1354 | lang = value; | 1488 | lang = value; |
@@ -1480,16 +1614,28 @@ ushort Keys::meta(const ushort uni) { | |||
1480 | ushort Keys::circumflex(const ushort uni) { | 1614 | ushort Keys::circumflex(const ushort uni) { |
1481 | 1615 | ||
1482 | if (circumflexMap[uni]) return circumflexMap[uni]; | 1616 | if (circumflexMap[uni]) return circumflexMap[uni]; |
1483 | else return 0; | 1617 | else return 0; |
1484 | } | 1618 | } |
1485 | 1619 | ||
1486 | ushort Keys::diaeresis(const ushort uni) { | 1620 | ushort Keys::diaeresis(const ushort uni) { |
1487 | 1621 | ||
1488 | if(diaeresisMap[uni]) return diaeresisMap[uni]; | 1622 | if(diaeresisMap[uni]) return diaeresisMap[uni]; |
1489 | else return 0; | 1623 | else return 0; |
1490 | } | 1624 | } |
1491 | 1625 | ||
1626 | ushort Keys::baccent(const ushort uni) { | ||
1627 | |||
1628 | if(baccentMap[uni]) return baccentMap[uni]; | ||
1629 | else return 0; | ||
1630 | } | ||
1631 | |||
1632 | ushort Keys::accent(const ushort uni) { | ||
1633 | |||
1634 | if(accentMap[uni]) return accentMap[uni]; | ||
1635 | else return 0; | ||
1636 | } | ||
1637 | |||
1492 | bool *Keys::pressedPtr(const int row, const int col) { | 1638 | bool *Keys::pressedPtr(const int row, const int col) { |
1493 | 1639 | ||
1494 | return keys[row].at(col)->pressed; | 1640 | return keys[row].at(col)->pressed; |
1495 | } | 1641 | } |
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index 8af80d0..bc74e71 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -57,24 +57,26 @@ public: | |||
57 | Keys(const char * filename); | 57 | Keys(const char * filename); |
58 | ~Keys(); | 58 | ~Keys(); |
59 | int width(const int row, const int col); | 59 | int width(const int row, const int col); |
60 | int rows(); | 60 | int rows(); |
61 | ushort uni(const int row, const int col); | 61 | ushort uni(const int row, const int col); |
62 | int qcode(const int row, const int col); | 62 | int qcode(const int row, const int col); |
63 | bool pressed(const int row, const int col); | 63 | bool pressed(const int row, const int col); |
64 | bool *pressedPtr(const int row, const int col); | 64 | bool *pressedPtr(const int row, const int col); |
65 | ushort shift(const ushort); | 65 | ushort shift(const ushort); |
66 | ushort meta(const ushort); | 66 | ushort meta(const ushort); |
67 | ushort circumflex(const ushort); | 67 | ushort circumflex(const ushort); |
68 | ushort diaeresis(const ushort); | 68 | ushort diaeresis(const ushort); |
69 | ushort baccent(const ushort); | ||
70 | ushort accent(const ushort); | ||
69 | QImage *pix(const int row, const int col); | 71 | QImage *pix(const int row, const int col); |
70 | int numKeys(const int row); | 72 | int numKeys(const int row); |
71 | void setKeysFromFile(const char *filename); | 73 | void setKeysFromFile(const char *filename); |
72 | void setKey(const int row, const int qcode, const ushort unicode, | 74 | void setKey(const int row, const int qcode, const ushort unicode, |
73 | const int width, QImage *pix); | 75 | const int width, QImage *pix); |
74 | void setPressed(const int row, const int col, const bool pressed); | 76 | void setPressed(const int row, const int col, const bool pressed); |
75 | QString lang; | 77 | QString lang; |
76 | QString label; | 78 | QString label; |
77 | 79 | ||
78 | private: | 80 | private: |
79 | 81 | ||
80 | typedef struct Key { | 82 | typedef struct Key { |
@@ -83,24 +85,26 @@ private: | |||
83 | int width; // not pixels but relative key width. normal key is 2 | 85 | int width; // not pixels but relative key width. normal key is 2 |
84 | 86 | ||
85 | // only needed for keys like ctrl that can have multiple keys pressed at once | 87 | // only needed for keys like ctrl that can have multiple keys pressed at once |
86 | bool *pressed; | 88 | bool *pressed; |
87 | QImage *pix; | 89 | QImage *pix; |
88 | }; | 90 | }; |
89 | 91 | ||
90 | QList<Key> keys[6]; | 92 | QList<Key> keys[6]; |
91 | QMap<ushort,ushort> shiftMap; | 93 | QMap<ushort,ushort> shiftMap; |
92 | QMap<ushort,ushort> metaMap; | 94 | QMap<ushort,ushort> metaMap; |
93 | QMap<ushort,ushort> circumflexMap; | 95 | QMap<ushort,ushort> circumflexMap; |
94 | QMap<ushort,ushort> diaeresisMap; | 96 | QMap<ushort,ushort> diaeresisMap; |
97 | QMap<ushort,ushort> baccentMap; | ||
98 | QMap<ushort,ushort> accentMap; | ||
95 | 99 | ||
96 | }; | 100 | }; |
97 | 101 | ||
98 | class Keyboard : public QFrame | 102 | class Keyboard : public QFrame |
99 | { | 103 | { |
100 | Q_OBJECT | 104 | Q_OBJECT |
101 | public: | 105 | public: |
102 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 106 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
103 | ~Keyboard(); | 107 | ~Keyboard(); |
104 | 108 | ||
105 | void resetState(); | 109 | void resetState(); |
106 | 110 | ||
@@ -129,24 +133,26 @@ private slots: | |||
129 | 133 | ||
130 | private: | 134 | private: |
131 | int getKey( int &w, int j = -1 ); | 135 | int getKey( int &w, int j = -1 ); |
132 | void clearHighlight(); | 136 | void clearHighlight(); |
133 | 137 | ||
134 | bool *shift; | 138 | bool *shift; |
135 | bool *lock; | 139 | bool *lock; |
136 | bool *ctrl; | 140 | bool *ctrl; |
137 | bool *alt; | 141 | bool *alt; |
138 | bool *meta; | 142 | bool *meta; |
139 | bool *circumflex; | 143 | bool *circumflex; |
140 | bool *diaeresis; | 144 | bool *diaeresis; |
145 | bool *baccent; | ||
146 | bool *accent; | ||
141 | 147 | ||
142 | uint useLargeKeys:1; | 148 | uint useLargeKeys:1; |
143 | uint usePicks:1; | 149 | uint usePicks:1; |
144 | uint useRepeat:1; | 150 | uint useRepeat:1; |
145 | 151 | ||
146 | int pressedKeyRow; | 152 | int pressedKeyRow; |
147 | int pressedKeyCol; | 153 | int pressedKeyCol; |
148 | 154 | ||
149 | KeyboardPicks *picks; | 155 | KeyboardPicks *picks; |
150 | 156 | ||
151 | int keyHeight; | 157 | int keyHeight; |
152 | int defaultKeyWidth; | 158 | int defaultKeyWidth; |