Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 92da8ca..3e43978 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -34,40 +34,45 @@ | |||
34 | 34 | ||
35 | #include <sys/utsname.h> | 35 | #include <sys/utsname.h> |
36 | 36 | ||
37 | 37 | ||
38 | #define USE_SMALL_BACKSPACE | 38 | #define USE_SMALL_BACKSPACE |
39 | 39 | ||
40 | /* Keyboard::Keyboard {{{1 */ | 40 | /* Keyboard::Keyboard {{{1 */ |
41 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 41 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
42 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), | 42 | QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), |
43 | alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), | 43 | alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), |
44 | unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0) | 44 | unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0) |
45 | { | 45 | { |
46 | // get the default font | ||
47 | Config qpeConfig( "qpe" ); | ||
48 | qpeConfig.setGroup( "Appearance" ); | ||
49 | QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" ); | ||
50 | |||
51 | setFont( QFont( familyStr, 8 ) ); | ||
46 | 52 | ||
47 | picks = new KeyboardPicks( this ); | 53 | picks = new KeyboardPicks( this ); |
48 | picks->setFont( QFont( "helvetica", 8 ) ); | 54 | picks->setFont( QFont( familyStr, 8 ) ); |
49 | setFont( QFont( "helvetica", 8 ) ); | ||
50 | picks->initialise(); | 55 | picks->initialise(); |
51 | if (usePicks) { | 56 | if (usePicks) { |
52 | 57 | ||
53 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 58 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
54 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 59 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
55 | 60 | ||
56 | } else picks->hide(); | 61 | } else picks->hide(); |
57 | 62 | ||
58 | Config config("locale"); | 63 | Config config("locale"); |
59 | config.setGroup( "Language" ); | 64 | config.setGroup( "Language" ); |
60 | LANG = config.readEntry( "Language" ); | 65 | //LANG = config.readEntry( "Language", "en" ); |
61 | if(LANG.isEmpty()) LANG = "en"; | 66 | LANG = "ko"; |
62 | 67 | ||
63 | repeatTimer = new QTimer( this ); | 68 | repeatTimer = new QTimer( this ); |
64 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 69 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
65 | 70 | ||
66 | } | 71 | } |
67 | 72 | ||
68 | /* Keyboard::resizeEvent {{{1 */ | 73 | /* Keyboard::resizeEvent {{{1 */ |
69 | void Keyboard::resizeEvent(QResizeEvent*) | 74 | void Keyboard::resizeEvent(QResizeEvent*) |
70 | { | 75 | { |
71 | int ph = picks->sizeHint().height(); | 76 | int ph = picks->sizeHint().height(); |
72 | picks->setGeometry( 0, 0, width(), ph ); | 77 | picks->setGeometry( 0, 0, width(), ph ); |
73 | keyHeight = (height()-(usePicks ? ph : 0))/5; | 78 | keyHeight = (height()-(usePicks ? ph : 0))/5; |
@@ -437,25 +442,25 @@ void Keyboard::clearHighlight() | |||
437 | pressedKeyCol = -1; | 442 | pressedKeyCol = -1; |
438 | 443 | ||
439 | QPainter p(this); | 444 | QPainter p(this); |
440 | drawKeyboard(p, tmpRow, tmpCol); | 445 | drawKeyboard(p, tmpRow, tmpCol); |
441 | } | 446 | } |
442 | } | 447 | } |
443 | 448 | ||
444 | 449 | ||
445 | /* Keyboard::sizeHint {{{1 */ | 450 | /* Keyboard::sizeHint {{{1 */ |
446 | QSize Keyboard::sizeHint() const | 451 | QSize Keyboard::sizeHint() const |
447 | { | 452 | { |
448 | QFontMetrics fm=fontMetrics(); | 453 | QFontMetrics fm=fontMetrics(); |
449 | int keyHeight = fm.lineSpacing()+2; | 454 | int keyHeight = fm.lineSpacing(); |
450 | 455 | ||
451 | return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); | 456 | return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); |
452 | } | 457 | } |
453 | 458 | ||
454 | 459 | ||
455 | void Keyboard::resetState() | 460 | void Keyboard::resetState() |
456 | { | 461 | { |
457 | schar = mchar = echar = 0; | 462 | schar = mchar = echar = 0; |
458 | picks->resetState(); | 463 | picks->resetState(); |
459 | } | 464 | } |
460 | 465 | ||
461 | /* korean input functions {{{1 | 466 | /* korean input functions {{{1 |
@@ -759,25 +764,27 @@ ushort Keyboard::constoe(const ushort c) { | |||
759 | } | 764 | } |
760 | 765 | ||
761 | 766 | ||
762 | // Keys::Keys {{{1 | 767 | // Keys::Keys {{{1 |
763 | 768 | ||
764 | Keys::Keys() { | 769 | Keys::Keys() { |
765 | 770 | ||
766 | Config config("locale"); | 771 | Config config("locale"); |
767 | config.setGroup( "Language" ); | 772 | config.setGroup( "Language" ); |
768 | QString l = config.readEntry( "Language" ); | 773 | QString l = config.readEntry( "Language" ); |
769 | if(l.isEmpty()) l = "en"; | 774 | if(l.isEmpty()) l = "en"; |
770 | 775 | ||
771 | QString key_map = QPEApplication::qpeDir() + "/i18n/" + l + "/keyboard"; | 776 | QString key_map = QPEApplication::qpeDir() + "/share/multikey/" |
777 | + /* l // testing korean for now */ | ||
778 | + "ko.keymap"; | ||
772 | 779 | ||
773 | setKeysFromFile(key_map); | 780 | setKeysFromFile(key_map); |
774 | } | 781 | } |
775 | 782 | ||
776 | Keys::Keys(const char * filename) { | 783 | Keys::Keys(const char * filename) { |
777 | 784 | ||
778 | setKeysFromFile(filename); | 785 | setKeysFromFile(filename); |
779 | } | 786 | } |
780 | 787 | ||
781 | // Keys::setKeysFromFile {{{2 | 788 | // Keys::setKeysFromFile {{{2 |
782 | void Keys::setKeysFromFile(const char * filename) { | 789 | void Keys::setKeysFromFile(const char * filename) { |
783 | 790 | ||