summaryrefslogtreecommitdiff
authorhash <hash>2002-11-08 05:36:29 (UTC)
committer hash <hash>2002-11-08 05:36:29 (UTC)
commit8ddf8df51c6193c362d2767491d34ca841a9c6c7 (patch) (unidiff)
tree26d55a25a0fcda215b2ecc98aa7747e8bed03b33
parent34cd9251667fe1b7f6ecae3cfe95c5450e0dbe7c (diff)
downloadopie-8ddf8df51c6193c362d2767491d34ca841a9c6c7.zip
opie-8ddf8df51c6193c362d2767491d34ca841a9c6c7.tar.gz
opie-8ddf8df51c6193c362d2767491d34ca841a9c6c7.tar.bz2
1. changed format from EUC-KR to UTF-8 (sorry about that)
2. made ctrl unsticky 3. the spanish accent and back accent shouldnt be the normal backtick char, so i changed them to the chars in 0x2c6 ~ 0x2cf (extended ticks and stuff)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp57
1 files changed, 33 insertions, 24 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index de3aa52..08318bd 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -319,114 +319,116 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
319 } 319 }
320 320
321} 321}
322 322
323 323
324/* Keyboard::mousePressEvent {{{1 */ 324/* Keyboard::mousePressEvent {{{1 */
325void Keyboard::mousePressEvent(QMouseEvent *e) 325void Keyboard::mousePressEvent(QMouseEvent *e)
326{ 326{
327 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; 327 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
328 if (row > 5) row = 5; 328 if (row > 5) row = 5;
329 329
330 // figure out the column 330 // figure out the column
331 int col = 0; 331 int col = 0;
332 for (int w = 0; e->x() >= w; col++) 332 for (int w = 0; e->x() >= w; col++)
333 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys 333 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
334 w += keys->width(row,col) * defaultKeyWidth; 334 w += keys->width(row,col) * defaultKeyWidth;
335 else break; 335 else break;
336 336
337 if (col <= 0) return; 337 if (col <= 0) return;
338 338
339 col --; // rewind one... 339 col --; // rewind one...
340 340
341 qkeycode = keys->qcode(row, col); 341 qkeycode = keys->qcode(row, col);
342 unicode = keys->uni(row, col); 342 unicode = keys->uni(row, col);
343 343
344 // might need to repaint if two or more of the same keys. 344 // might need to repaint if two or more of the same keys.
345 // should be faster if just paint one key even though multiple keys exist. 345 // should be faster if just paint one key even though multiple keys exist.
346 bool need_repaint = FALSE; 346 bool need_repaint = FALSE;
347 347
348 // circumflex and diaeresis support 348 // circumflex and diaeresis support
349 // messy to have this here, but too hard to implement any other method 349 // messy to have this here, but too hard to implement any other method
350 if (unicode == 0x2c6) { 350 if (unicode == 0x2c6) {
351 351
352 unicode = 0; 352 unicode = 0;
353 if (shift || lock) { 353 if (shift || lock) {
354 354
355 // diaeresis 355 // diaeresis
356 qkeycode = 0x2001; 356 qkeycode = 0x2001;
357 } 357 }
358 else { 358 else {
359 359
360 // circumflex 360 // circumflex
361 qkeycode = 0x2000; 361 qkeycode = 0x2000;
362 } 362 }
363 } 363 }
364 364
365 // Back accent character support 365 // Back accent character support
366 366
367 if (unicode == 0x60) { 367 //if (unicode == 0x60) { // the keys from 2c6 ~ 2cf should be used instead of the ascii one
368 if (unicode == 0x2cb) {
368 369
369 unicode = 0; 370 unicode = 0;
370 if (shift || lock) { 371 if (shift || lock) {
371 372
372 // circumblex 373 // circumblex
373 qkeycode = 0x2000; 374 qkeycode = 0x2000;
374 } 375 }
375 else { 376 else {
376 377
377 // back accent 378 // back accent
378 qkeycode = 0x2002; 379 qkeycode = 0x2002;
379 } 380 }
380 } 381 }
381 382
382 // Accent character support 383 // Accent character support
383 384
384 if (unicode == 0xb4) { 385 //if (unicode == 0xb4) {
386 if (unicode == 0x2ca) {
385 387
386 unicode = 0; 388 unicode = 0;
387 if (shift || lock) { 389 if (shift || lock) {
388 390
389 // diaeresis 391 // diaeresis
390 qkeycode = 0x2001; 392 qkeycode = 0x2001;
391 } 393 }
392 else { 394 else {
393 395
394 // accent 396 // accent
395 qkeycode = 0x2003; 397 qkeycode = 0x2003;
396 } 398 }
397 } 399 }
398 400
399 401
400 if (unicode == 0) { // either Qt char, or nothing 402 if (unicode == 0) { // either Qt char, or nothing
401 403
402 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 404 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
403 405
404 if ( configdlg ) { 406 if ( configdlg ) {
405 407
406 delete (ConfigDlg *) configdlg; 408 delete (ConfigDlg *) configdlg;
407 configdlg = 0; 409 configdlg = 0;
408 } 410 }
409 else { 411 else {
410 configdlg = new ConfigDlg (); 412 configdlg = new ConfigDlg ();
411 connect(configdlg, SIGNAL(setMapToDefault()), 413 connect(configdlg, SIGNAL(setMapToDefault()),
412 this, SLOT(setMapToDefault())); 414 this, SLOT(setMapToDefault()));
413 connect(configdlg, SIGNAL(setMapToFile(QString)), 415 connect(configdlg, SIGNAL(setMapToFile(QString)),
414 this, SLOT(setMapToFile(QString))); 416 this, SLOT(setMapToFile(QString)));
415 connect(configdlg, SIGNAL(pickboardToggled(bool)), 417 connect(configdlg, SIGNAL(pickboardToggled(bool)),
416 this, SLOT(togglePickboard(bool))); 418 this, SLOT(togglePickboard(bool)));
417 connect(configdlg, SIGNAL(repeatToggled(bool)), 419 connect(configdlg, SIGNAL(repeatToggled(bool)),
418 this, SLOT(toggleRepeat(bool))); 420 this, SLOT(toggleRepeat(bool)));
419 connect(configdlg, SIGNAL(reloadKeyboard()), 421 connect(configdlg, SIGNAL(reloadKeyboard()),
420 this, SLOT(reloadKeyboard())); 422 this, SLOT(reloadKeyboard()));
421 connect(configdlg, SIGNAL(configDlgClosed()), 423 connect(configdlg, SIGNAL(configDlgClosed()),
422 this, SLOT(cleanupConfigDlg())); 424 this, SLOT(cleanupConfigDlg()));
423 configdlg->showMaximized(); 425 configdlg->showMaximized();
424 configdlg->show(); 426 configdlg->show();
425 configdlg->raise(); 427 configdlg->raise();
426 } 428 }
427 429
428 } else if (qkeycode == Qt::Key_Control) { 430 } else if (qkeycode == Qt::Key_Control) {
429 need_repaint = TRUE; 431 need_repaint = TRUE;
430 432
431 if (ctrl) { 433 if (ctrl) {
432 434
@@ -721,96 +723,103 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
721 dc->incBackspaces(); 723 dc->incBackspaces();
722 } 724 }
723 } 725 }
724 picks->repaint(); 726 picks->repaint();
725 } 727 }
726 728
727 729
728 // painting 730 // painting
729 pressed = TRUE; 731 pressed = TRUE;
730 732
731 pressedKeyRow = row; 733 pressedKeyRow = row;
732 pressedKeyCol = col; 734 pressedKeyCol = col;
733 735
734 if (need_repaint) repaint(FALSE); 736 if (need_repaint) repaint(FALSE);
735 else { // just paint the one key pressed 737 else { // just paint the one key pressed
736 738
737 739
738 740
739 QPainter p(this); 741 QPainter p(this);
740 drawKeyboard(p, row, col); 742 drawKeyboard(p, row, col);
741 743
742 } 744 }
743 745
744 if (useRepeat) repeatTimer->start( 800 ); 746 if (useRepeat) repeatTimer->start( 800 );
745 //pressTid = startTimer(80); 747 //pressTid = startTimer(80);
746 748
747} 749}
748 750
749 751
750/* Keyboard::mouseReleaseEvent {{{1 */ 752/* Keyboard::mouseReleaseEvent {{{1 */
751void Keyboard::mouseReleaseEvent(QMouseEvent*) 753void Keyboard::mouseReleaseEvent(QMouseEvent*)
752{ 754{
753 pressed = FALSE; 755 pressed = FALSE;
754 //if ( pressTid == 0 ) 756 //if ( pressTid == 0 )
755#if defined(Q_WS_QWS) || defined(_WS_QWS_) 757#if defined(Q_WS_QWS) || defined(_WS_QWS_)
756 if ( unicode != -1 ) { 758 if ( unicode != -1 ) {
757 emit key( unicode, qkeycode, modifiers, false, false ); 759 emit key( unicode, qkeycode, modifiers, false, false );
758 repeatTimer->stop(); 760 repeatTimer->stop();
759 } 761 }
760#endif 762#endif
761 if (shift && unicode != 0) { 763 if (shift && unicode != 0) {
762 764
763 765
764 *shift = 0; // unpress shift key 766 *shift = 0; // unpress shift key
765 shift = 0; // reset the shift pointer 767 shift = 0; // reset the shift pointer
766 repaint(FALSE); 768 repaint(FALSE);
767 769
768 } 770 }
771 if (ctrl && unicode != 0) {
772
773 *ctrl = 0;
774 ctrl = 0;
775 repaint(FALSE);
776
777 }
769 778
770 /* 779 /*
771 * do not make the meta key release after being pressed 780 * do not make the meta key release after being pressed
772 * 781 *
773 782
774 else if (meta && unicode != 0) { 783 else if (meta && unicode != 0) {
775 784
776 *meta = 0; 785 *meta = 0;
777 meta = 0; 786 meta = 0;
778 repaint(FALSE); 787 repaint(FALSE);
779 } 788 }
780 789
781 */ 790 */
782 791
783 else clearHighlight(); 792 else clearHighlight();
784} 793}
785 794
786/* Keyboard::timerEvent {{{1 */ 795/* Keyboard::timerEvent {{{1 */
787 796
788/* dont know what this does, but i think it is here so that if your screen 797/* dont know what this does, but i think it is here so that if your screen
789 * sticks (like on an ipaq) then it will stop repeating if you click another 798 * sticks (like on an ipaq) then it will stop repeating if you click another
790 * key... but who knows what anything does in this thing anyway? 799 * key... but who knows what anything does in this thing anyway?
791 800
792 void Keyboard::timerEvent(QTimerEvent* e) 801 void Keyboard::timerEvent(QTimerEvent* e)
793{ 802{
794 if ( e->timerId() == pressTid ) { 803 if ( e->timerId() == pressTid ) {
795 killTimer(pressTid); 804 killTimer(pressTid);
796 pressTid = 0; 805 pressTid = 0;
797 if ( !pressed ) 806 if ( !pressed )
798 cout << "calling clearHighlight from timerEvent\n"; 807 cout << "calling clearHighlight from timerEvent\n";
799 //clearHighlight(); 808 //clearHighlight();
800 } 809 }
801} 810}
802*/ 811*/
803 812
804void Keyboard::repeat() 813void Keyboard::repeat()
805{ 814{
806 815
807 repeatTimer->start( 200 ); 816 repeatTimer->start( 200 );
808 emit key( unicode, qkeycode, modifiers, true, true ); 817 emit key( unicode, qkeycode, modifiers, true, true );
809} 818}
810 819
811void Keyboard::clearHighlight() 820void Keyboard::clearHighlight()
812{ 821{
813 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) { 822 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) {
814 int tmpRow = pressedKeyRow; 823 int tmpRow = pressedKeyRow;
815 int tmpCol = pressedKeyCol; 824 int tmpCol = pressedKeyCol;
816 825
@@ -970,181 +979,181 @@ void Keyboard::loadKeyboardColors() {
970 color = QStringList::split(",", "240,240,240"); 979 color = QStringList::split(",", "240,240,240");
971 config.writeEntry("keycolor", color.join(",")); 980 config.writeEntry("keycolor", color.join(","));
972 981
973 } 982 }
974 keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 983 keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
975 984
976 color = config.readListEntry("keycolor_pressed", QChar(',')); 985 color = config.readListEntry("keycolor_pressed", QChar(','));
977 if (color.isEmpty()) { 986 if (color.isEmpty()) {
978 color = QStringList::split(",", "171,183,198"); 987 color = QStringList::split(",", "171,183,198");
979 config.writeEntry("keycolor_pressed", color.join(",")); 988 config.writeEntry("keycolor_pressed", color.join(","));
980 989
981 } 990 }
982 keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 991 keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
983 992
984 color = config.readListEntry("keycolor_lines", QChar(',')); 993 color = config.readListEntry("keycolor_lines", QChar(','));
985 if (color.isEmpty()) { 994 if (color.isEmpty()) {
986 color = QStringList::split(",", "138,148,160"); 995 color = QStringList::split(",", "138,148,160");
987 config.writeEntry("keycolor_lines", color.join(",")); 996 config.writeEntry("keycolor_lines", color.join(","));
988 997
989 } 998 }
990 keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 999 keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
991 1000
992 color = config.readListEntry("textcolor", QChar(',')); 1001 color = config.readListEntry("textcolor", QChar(','));
993 if (color.isEmpty()) { 1002 if (color.isEmpty()) {
994 color = QStringList::split(",", "43,54,68"); 1003 color = QStringList::split(",", "43,54,68");
995 config.writeEntry("textcolor", color.join(",")); 1004 config.writeEntry("textcolor", color.join(","));
996 1005
997 } 1006 }
998 textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 1007 textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
999 1008
1000} 1009}
1001 1010
1002/* korean input functions {{{1 1011/* korean input functions {{{1
1003 * 1012 *
1004 * TODO 1013 * TODO
1005 * one major problem with this implementation is that you can't move the 1014 * one major problem with this implementation is that you can't move the
1006 * cursor after inputing korean chars, otherwise it will eat up and replace 1015 * cursor after inputing korean chars, otherwise it will eat up and replace
1007 * the char before the cursor you move to. fix that 1016 * the char before the cursor you move to. fix that
1008 * 1017 *
1009 * make backspace delete one single char, not the whole thing if still 1018 * make backspace delete one single char, not the whole thing if still
1010 * editing. 1019 * editing.
1011 * 1020 *
1012 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 1021 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1013 * 1022 *
1014 * how korean input works 1023 * how korean input works
1015 * 1024 *
1016 * all following chars means unicode char value and are in hex 1025 * all following chars means unicode char value and are in hex
1017 * 1026 *
1018 * = schar (start char) 1027 * 초음 = schar (start char)
1019 * = mchar (middle char) 1028 * 중음 = mchar (middle char)
1020 * = echar (end char) 1029 * 끝음 = echar (end char)
1021 * 1030 *
1022 * there are 19 schars. unicode position is at 1100 - 1112 1031 * there are 19 schars. unicode position is at 1100 - 1112
1023 * there are 21 mchars. unicode position is at 1161 - 1175 1032 * there are 21 mchars. unicode position is at 1161 - 1175
1024 * there are 27 echars. unicode position is at 11a8 - 11c2 1033 * there are 27 echars. unicode position is at 11a8 - 11c2
1025 * 1034 *
1026 * the map with everything combined is at ac00 - d7a3 1035 * the map with everything combined is at ac00 - d7a3
1027 * 1036 *
1028 */ 1037 */
1029 1038
1030ushort Keyboard::parseKoreanInput (ushort c) { 1039ushort Keyboard::parseKoreanInput (ushort c) {
1031 1040
1032 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) 1041 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c))
1033 || 1042 ||
1034 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode 1043 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode
1035 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { 1044 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) {
1036 1045
1037 schar = 0, mchar = 0, echar = 0; 1046 schar = 0, mchar = 0, echar = 0;
1038 return c; 1047 return c;
1039 } 1048 }
1040 1049
1041 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input 1050 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input
1042 1051
1043 if (schar == 0 || (schar != 0 && mchar == 0)) { 1052 if (schar == 0 || (schar != 0 && mchar == 0)) {
1044 schar = c; mchar = 0; echar = 0; 1053 schar = c; mchar = 0; echar = 0;
1045 return c; 1054 return c;
1046 } 1055 }
1047 else if (mchar != 0) { 1056 else if (mchar != 0) {
1048 1057
1049 if (echar == 0) { 1058 if (echar == 0) {
1050 1059
1051 if (!(echar = constoe(c))) { 1060 if (!(echar = constoe(c))) {
1052 1061
1053 schar = c; mchar = 0; echar = 0; 1062 schar = c; mchar = 0; echar = 0;
1054 return c; 1063 return c;
1055 } 1064 }
1056 1065
1057 } 1066 }
1058 else { // must figure out what the echar is 1067 else { // must figure out what the echar is
1059 1068
1060 if (echar == 0x11a8) { // 1069 if (echar == 0x11a8) { //
1061 1070
1062 if (c == 0x1100) echar = 0x11a9; // + 1071 if (c == 0x1100) echar = 0x11a9; // +
1063 else if (c == 0x1109) echar = 0x11aa; // + 1072 else if (c == 0x1109) echar = 0x11aa; // +
1064 else { 1073 else {
1065 schar = c; mchar = 0; echar = 0; 1074 schar = c; mchar = 0; echar = 0;
1066 return c; 1075 return c;
1067 } 1076 }
1068 1077
1069 } else if (echar == 0x11ab) { // 1078 } else if (echar == 0x11ab) { //
1070 1079
1071 if (c == 0x110c) echar = 0x11ac; // + 1080 if (c == 0x110c) echar = 0x11ac; // +
1072 else if (c == 0x1112) echar = 0x11ad; // + 1081 else if (c == 0x1112) echar = 0x11ad; // +
1073 else { 1082 else {
1074 schar = c; mchar = 0; echar = 0; 1083 schar = c; mchar = 0; echar = 0;
1075 return c; 1084 return c;
1076 } 1085 }
1077 1086
1078 } else if (echar == 0x11af) { // 1087 } else if (echar == 0x11af) { //
1079 1088
1080 if (c == 0x1100) echar = 0x11b0; // + 1089 if (c == 0x1100) echar = 0x11b0; // +
1081 else if (c == 0x1106) echar = 0x11b1; // + 1090 else if (c == 0x1106) echar = 0x11b1; // +
1082 else if (c == 0x1107) echar = 0x11b2; // + 1091 else if (c == 0x1107) echar = 0x11b2; // +
1083 else if (c == 0x1109) echar = 0x11b3; // + 1092 else if (c == 0x1109) echar = 0x11b3; // +
1084 else if (c == 0x1110) echar = 0x11b4; // + 1093 else if (c == 0x1110) echar = 0x11b4; // +
1085 else if (c == 0x1111) echar = 0x11b5; // + 1094 else if (c == 0x1111) echar = 0x11b5; // +
1086 else if (c == 0x1112) echar = 0x11b6; // + 1095 else if (c == 0x1112) echar = 0x11b6; // +
1087 else { 1096 else {
1088 schar = c; mchar = 0; echar = 0; 1097 schar = c; mchar = 0; echar = 0;
1089 return c; 1098 return c;
1090 } 1099 }
1091 1100
1092 } else if (echar == 0x11b8) { // 1101 } else if (echar == 0x11b8) { //
1093 1102
1094 if (c == 0x1109) echar = 0x11b9; // + 1103 if (c == 0x1109) echar = 0x11b9; // +
1095 else { 1104 else {
1096 schar = c; mchar = 0; echar = 0; 1105 schar = c; mchar = 0; echar = 0;
1097 return c; 1106 return c;
1098 } 1107 }
1099 1108
1100 } else if (echar == 0x11ba) { // 1109 } else if (echar == 0x11ba) { //
1101 1110
1102 if (c == 0x1109) echar = 0x11bb; // + 1111 if (c == 0x1109) echar = 0x11bb; // +
1103 else { 1112 else {
1104 schar = c; mchar = 0; echar = 0; 1113 schar = c; mchar = 0; echar = 0;
1105 return c; 1114 return c;
1106 } 1115 }
1107 1116
1108 } else { // if any other char, cannot combine chars 1117 } else { // if any other char, cannot combine chars
1109 1118
1110 schar = c; mchar = 0; echar = 0; 1119 schar = c; mchar = 0; echar = 0;
1111 return c; 1120 return c;
1112 } 1121 }
1113 1122
1114 unicode = echar; 1123 unicode = echar;
1115 } 1124 }
1116 } 1125 }
1117 1126
1118 } 1127 }
1119 else if (0x1161 <= c && c <= 0x1175) { // mchar was input 1128 else if (0x1161 <= c && c <= 0x1175) { // mchar was input
1120 1129
1121 if (schar != 0 && mchar == 0) { mchar = c; } 1130 if (schar != 0 && mchar == 0) { mchar = c; }
1122 1131
1123 else if (schar != 0 && mchar != 0 && echar == 0) { 1132 else if (schar != 0 && mchar != 0 && echar == 0) {
1124 1133
1125 switch (mchar) { 1134 switch (mchar) {
1126 case 0x1169: 1135 case 0x1169:
1127 if (c == 0x1161) mchar = 0x116a; 1136 if (c == 0x1161) mchar = 0x116a;
1128 else if (c == 0x1162) mchar = 0x116b; 1137 else if (c == 0x1162) mchar = 0x116b;
1129 else if (c == 0x1175) mchar = 0x116c; 1138 else if (c == 0x1175) mchar = 0x116c;
1130 else { 1139 else {
1131 schar = 0; mchar = 0; echar = 0; 1140 schar = 0; mchar = 0; echar = 0;
1132 return c; 1141 return c;
1133 } 1142 }
1134 break; 1143 break;
1135 case 0x116e: 1144 case 0x116e:
1136 if (c == 0x1165) mchar = 0x116f; 1145 if (c == 0x1165) mchar = 0x116f;
1137 else if (c == 0x1166) mchar = 0x1170; 1146 else if (c == 0x1166) mchar = 0x1170;
1138 else if (c == 0x1175) mchar = 0x1171; 1147 else if (c == 0x1175) mchar = 0x1171;
1139 else { 1148 else {
1140 schar = 0; mchar = 0; echar = 0; 1149 schar = 0; mchar = 0; echar = 0;
1141 return c; 1150 return c;
1142 } 1151 }
1143 break; 1152 break;
1144 case 0x1173: 1153 case 0x1173:
1145 if (c == 0x1175) mchar = 0x1174; 1154 if (c == 0x1175) mchar = 0x1174;
1146 else { 1155 else {
1147 schar = 0; mchar = 0; echar = 0; 1156 schar = 0; mchar = 0; echar = 0;
1148 return c; 1157 return c;
1149 } 1158 }
1150 break; 1159 break;
@@ -1417,97 +1426,97 @@ void Keys::setKeysFromFile(const char * filename) {
1417 1426
1418 // meta key map 1427 // meta key map
1419 else if (buf.contains(QRegExp("^\\s*m\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { 1428 else if (buf.contains(QRegExp("^\\s*m\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
1420 1429
1421 QTextStream tmp (buf, IO_ReadOnly); 1430 QTextStream tmp (buf, IO_ReadOnly);
1422 ushort lower, shift; 1431 ushort lower, shift;
1423 QChar m; 1432 QChar m;
1424 tmp >> m >> lower >> shift; 1433 tmp >> m >> lower >> shift;
1425 1434
1426 metaMap.insert(lower, shift); 1435 metaMap.insert(lower, shift);
1427 1436
1428 buf = t.readLine(); 1437 buf = t.readLine();
1429 } 1438 }
1430 1439
1431 // circumflex 1440 // circumflex
1432 else if (buf.contains(QRegExp("^\\s*c\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { 1441 else if (buf.contains(QRegExp("^\\s*c\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
1433 1442
1434 QTextStream tmp (buf, IO_ReadOnly); 1443 QTextStream tmp (buf, IO_ReadOnly);
1435 ushort lower, shift; 1444 ushort lower, shift;
1436 QChar c; 1445 QChar c;
1437 tmp >> c >> lower >> shift; 1446 tmp >> c >> lower >> shift;
1438 1447
1439 circumflexMap.insert(lower, shift); 1448 circumflexMap.insert(lower, shift);
1440 1449
1441 buf = t.readLine(); 1450 buf = t.readLine();
1442 } 1451 }
1443 // diaeresis 1452 // diaeresis
1444 else if (buf.contains(QRegExp("^\\s*d\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { 1453 else if (buf.contains(QRegExp("^\\s*d\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
1445 1454
1446 QTextStream tmp (buf, IO_ReadOnly); 1455 QTextStream tmp (buf, IO_ReadOnly);
1447 ushort lower, shift; 1456 ushort lower, shift;
1448 QChar d; 1457 QChar d;
1449 tmp >> d >> lower >> shift; 1458 tmp >> d >> lower >> shift;
1450 1459
1451 diaeresisMap.insert(lower, shift); 1460 diaeresisMap.insert(lower, shift);
1452 1461
1453 buf = t.readLine(); 1462 buf = t.readLine();
1454 } 1463 }
1455 // back accent 1464 // back accent
1456 else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { 1465 else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
1457 1466
1458 QTextStream tmp (buf, IO_ReadOnly); 1467 QTextStream tmp (buf, IO_ReadOnly);
1459 ushort lower, shift; 1468 ushort lower, shift;
1460 QChar d; 1469 QChar d;
1461 tmp >> d >> lower >> shift; 1470 tmp >> d >> lower >> shift;
1462 1471
1463 baccentMap.insert(lower, shift); 1472 baccentMap.insert(lower, shift);
1464 1473
1465 qDebug ("Estoy aadiendo %i con %i", lower, shift); 1474 qDebug ("Estoy aadiendo %i con %i", lower, shift);
1466 buf = t.readLine(); 1475 buf = t.readLine();
1467 } 1476 }
1468 // accent 1477 // accent
1469 else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { 1478 else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
1470 1479
1471 QTextStream tmp (buf, IO_ReadOnly); 1480 QTextStream tmp (buf, IO_ReadOnly);
1472 ushort lower, shift; 1481 ushort lower, shift;
1473 QChar d; 1482 QChar d;
1474 tmp >> d >> lower >> shift; 1483 tmp >> d >> lower >> shift;
1475 1484
1476 accentMap.insert(lower, shift); 1485 accentMap.insert(lower, shift);
1477 1486
1478 buf = t.readLine(); 1487 buf = t.readLine();
1479 } 1488 }
1480 1489
1481 // other variables like lang & title 1490 // other variables like lang & title
1482 else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { 1491 else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) {
1483 1492
1484 QTextStream tmp (buf, IO_ReadOnly); 1493 QTextStream tmp (buf, IO_ReadOnly);
1485 QString name, equals, value; 1494 QString name, equals, value;
1486 1495
1487 tmp >> name >> equals >> value; 1496 tmp >> name >> equals >> value;
1488 1497
1489 if (name == "lang") { 1498 if (name == "lang") {
1490 1499
1491 lang = value; 1500 lang = value;
1492 1501
1493 } 1502 }
1494 1503
1495 buf = t.readLine(); 1504 buf = t.readLine();
1496 } 1505 }
1497 // comments 1506 // comments
1498 else if (buf.contains(QRegExp("^\\s*#"))) { 1507 else if (buf.contains(QRegExp("^\\s*#"))) {
1499 1508
1500 buf = t.readLine(); 1509 buf = t.readLine();
1501 1510
1502 } else { // blank line, or garbage 1511 } else { // blank line, or garbage
1503 1512
1504 buf = t.readLine(); 1513 buf = t.readLine();
1505 1514
1506 } 1515 }
1507 1516
1508 } 1517 }
1509 f.close(); 1518 f.close();
1510 } 1519 }
1511 1520
1512} 1521}
1513 1522