summaryrefslogtreecommitdiff
authorhash <hash>2002-08-15 09:49:41 (UTC)
committer hash <hash>2002-08-15 09:49:41 (UTC)
commit56d64478a06c6d4bf137e2e0dcf5ed7d85dadb71 (patch) (unidiff)
tree55037c6d09c9b2324a3a02d4c3a89db95e586ee1
parentb54a9a4b4188ff4759574028f7ea0e231ee6bed3 (diff)
downloadopie-56d64478a06c6d4bf137e2e0dcf5ed7d85dadb71.zip
opie-56d64478a06c6d4bf137e2e0dcf5ed7d85dadb71.tar.gz
opie-56d64478a06c6d4bf137e2e0dcf5ed7d85dadb71.tar.bz2
keymap dynamic loading works, but no file select dialog. remembers your selected keymap too
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp26
-rw-r--r--inputmethods/multikey/configdlg.h5
-rw-r--r--inputmethods/multikey/keyboard.cpp158
-rw-r--r--inputmethods/multikey/keyboard.h8
4 files changed, 152 insertions, 45 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index e39fa6a..68c31be 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,100 +1,120 @@
1/* 1/*
2 * TODO 2 * TODO
3 * make a font selection thing 3 * make a font selection thing
4 * 4 *
5 * FIXME 5 * FIXME
6 * if you open the config dialog and close it from the little (x) button on the title bar, 6 * if you open the config dialog and close it from the little (x) button on the title bar,
7 * you have to hit the button on the keyboard twice for it to open the next time 7 * you have to hit the button on the keyboard twice for it to open the next time
8 * 8 *
9 * 9 *
10 */ 10 */
11 11
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14 14
15#include <qwidget.h> 15#include <qwidget.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qtabwidget.h> 17#include <qtabwidget.h>
18#include <qvbox.h> 18#include <qvbox.h>
19#include <qgrid.h> 19#include <qgrid.h>
20#include <qgroupbox.h> 20#include <qgroupbox.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qcheckbox.h> 22#include <qcheckbox.h>
23#include <qsizepolicy.h> 23#include <qsizepolicy.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include "configdlg.h" 26#include "configdlg.h"
27#include "keyboard.h" 27#include "keyboard.h"
28 28
29ConfigDlg::ConfigDlg () : QTabWidget () 29ConfigDlg::ConfigDlg () : QTabWidget ()
30{ 30{
31 setCaption( tr("Multikey Configuration") ); 31 setCaption( tr("Multikey Configuration") );
32 32
33 /* 33 /*
34 * 'general config' tab 34 * 'general config' tab
35 */ 35 */
36 36
37 QVBox *gen_box = new QVBox (this); 37 QVBox *gen_box = new QVBox (this);
38 gen_box->setMargin(3); 38 gen_box->setMargin(3);
39 addTab(gen_box, tr("General Settings")); 39 addTab(gen_box, tr("General Settings"));
40 40
41 QGroupBox *map_group = new QGroupBox (2, Qt::Horizontal, tr("Keymap File"), gen_box); 41 QGroupBox *map_group = new QGroupBox (2, Qt::Horizontal, tr("Keymap File"), gen_box);
42 42
43 QComboBox *combo = new QComboBox ((bool)0, map_group); 43 map_combo = new QComboBox ((bool)0, map_group);
44 map_combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
45
44 QString cur(tr("Current Language")); 46 QString cur(tr("Current Language"));
45 combo->insertItem(cur); 47 map_combo->insertItem(cur);
46 combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 48 connect(map_combo, SIGNAL(activated(int)), SLOT(setMap(int)));
49
50 QString ko(tr("/opt/opie/share/multikey/ko.keymap"));
51 map_combo->insertItem(ko);
52
53 QString en(tr("/opt/opie/share/multikey/en.keymap"));
54 map_combo->insertItem(en);
47 55
48 QPushButton *button = new QPushButton(tr("Browse..."), map_group); 56 QPushButton *button = new QPushButton(tr("Browse..."), map_group);
49 button->setFlat((bool)1); 57 button->setFlat((bool)1);
50 58
51 pick_button = new QCheckBox(tr("Pickboard"), gen_box); 59 pick_button = new QCheckBox(tr("Pickboard"), gen_box);
52 60
53 Config config ("multikey"); 61 Config config ("multikey");
54 config.setGroup ("pickboard"); 62 config.setGroup ("pickboard");
55 bool pick_open = config.readBoolEntry ("open", "0"); // default closed 63 bool pick_open = config.readBoolEntry ("open", "0"); // default closed
56 if (pick_open) { 64 if (pick_open) {
57 65
58 pick_button->setChecked(true); 66 pick_button->setChecked(true);
59 } 67 }
60 68
61 // by connecting it after checking it, the signal isn't emmited 69 // by connecting it after checking it, the signal isn't emmited
62 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); 70 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
63 71
64 /* 72 /*
65 * 'color' tab 73 * 'color' tab
66 */ 74 */
67 75
68 QGrid *color_box = new QGrid(2, this); 76 QGrid *color_box = new QGrid(2, this);
69 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 77 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
70 color_box->setMargin(3); 78 color_box->setMargin(3);
71 addTab(color_box, tr("Colors")); 79 addTab(color_box, tr("Colors"));
72 80
73 QLabel *label; 81 QLabel *label;
74 82
75 label = new QLabel(tr("Key Color"), color_box); 83 label = new QLabel(tr("Key Color"), color_box);
76 button = new QPushButton(color_box); 84 button = new QPushButton(color_box);
77 button->setFlat((bool)1); 85 button->setFlat((bool)1);
78 label = new QLabel(tr("Key Pressed Color"), color_box); 86 label = new QLabel(tr("Key Pressed Color"), color_box);
79 button = new QPushButton(color_box); 87 button = new QPushButton(color_box);
80 button->setFlat((bool)1); 88 button->setFlat((bool)1);
81 label = new QLabel(tr("Line Color"), color_box); 89 label = new QLabel(tr("Line Color"), color_box);
82 button = new QPushButton(color_box); 90 button = new QPushButton(color_box);
83 button->setFlat((bool)1); 91 button->setFlat((bool)1);
84 label = new QLabel(tr("Text Color"), color_box); 92 label = new QLabel(tr("Text Color"), color_box);
85 button = new QPushButton(color_box); 93 button = new QPushButton(color_box);
86 button->setFlat((bool)1); 94 button->setFlat((bool)1);
87 95
88 label = new QLabel("", color_box); // a spacer so the above buttons dont expand 96 label = new QLabel("", color_box); // a spacer so the above buttons dont expand
89 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 97 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
90 98
91} 99}
92 100
93void ConfigDlg::pickTog() { 101void ConfigDlg::pickTog() {
94 102
95 Config config ("multikey"); 103 Config config ("multikey");
96 config.setGroup ("pickboard"); 104 config.setGroup ("pickboard");
97 config.writeEntry ("open", pick_button->isChecked()); // default closed 105 config.writeEntry ("open", pick_button->isChecked()); // default closed
98 106
99 emit pickboardToggled(pick_button->isChecked()); 107 emit pickboardToggled(pick_button->isChecked());
100} 108}
109
110void ConfigDlg::setMap(int index) {
111
112 if (index == 0) {
113
114 emit setMapToDefault();
115 }
116 else {
117
118 emit setMapToFile(map_combo->text(index));
119 }
120}
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index 21bdb17..54127a0 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -1,26 +1,31 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qtabwidget.h> 2#include <qtabwidget.h>
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qcombobox.h>
4 5
5#ifndef CONFIGDLG_H 6#ifndef CONFIGDLG_H
6#define CONFIGDLG_H 7#define CONFIGDLG_H
7 8
8class ConfigDlg : public QTabWidget 9class ConfigDlg : public QTabWidget
9{ 10{
10 Q_OBJECT 11 Q_OBJECT
11 12
12public: 13public:
13 ConfigDlg (); 14 ConfigDlg ();
14 15
15signals: 16signals:
16 void pickboardToggled(bool on_off); 17 void pickboardToggled(bool on_off);
18 void setMapToDefault();
19 void setMapToFile(QString file);
17 20
18private slots: 21private slots:
19 void pickTog(); 22 void pickTog();
23 void setMap(int index);
20 24
21private: 25private:
22 QCheckBox *pick_button; 26 QCheckBox *pick_button;
27 QComboBox *map_combo;
23 28
24}; 29};
25 30
26#endif 31#endif
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index a19f07a..1d91b82 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -1,587 +1,632 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "keyboard.h" 21#include "keyboard.h"
22#include "configdlg.h" 22#include "configdlg.h"
23 23
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26 26
27#include <qwindowsystem_qws.h> 27#include <qwindowsystem_qws.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qfontmetrics.h> 29#include <qfontmetrics.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
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 <iostream.h>
36 37
37#include <sys/utsname.h> 38#include <sys/utsname.h>
38 39
39 40
40#define USE_SMALL_BACKSPACE 41#define USE_SMALL_BACKSPACE
41 42
42/* Keyboard::Keyboard {{{1 */ 43/* Keyboard::Keyboard {{{1 */
43Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 44Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
44 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), 45 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0),
45 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), 46 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1),
46 unicode(-1), qkeycode(0), modifiers(0), LANG("ko"), schar(0), mchar(0), echar(0), 47 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
47 configdlg(0) 48 configdlg(0)
48 49
49{ 50{
50 // get the default font 51 // get the default font
51 Config qpeConfig( "qpe" ); 52 Config *config = new Config( "qpe" );
52 qpeConfig.setGroup( "Appearance" ); 53 config->setGroup( "Appearance" );
53 QString familyStr = qpeConfig.readEntry( "FontFamily", "fixed" ); 54 QString familyStr = config->readEntry( "FontFamily", "fixed" );
55 delete config;
54 56
55 Config multiConfig ("multikey"); 57 config = new Config("multikey");
56 multiConfig.setGroup ("pickboard"); 58 config->setGroup ("pickboard");
57 usePicks = multiConfig.readBoolEntry ("open", "0"); // default closed 59 usePicks = config->readBoolEntry ("open", "0"); // default closed
60 delete config;
58 61
59 setFont( QFont( familyStr, 8 ) ); 62 setFont( QFont( familyStr, 8 ) );
60 63
61 picks = new KeyboardPicks( this ); 64 picks = new KeyboardPicks( this );
62 picks->setFont( QFont( familyStr, 8 ) ); 65 picks->setFont( QFont( familyStr, 8 ) );
63 picks->initialise(); 66 picks->initialise();
64 if (usePicks) { 67 if (usePicks) {
65 68
66 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 69 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
67 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 70 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
68 71
69 } else picks->hide(); 72 } else picks->hide();
70 73
71 Config config("locale"); 74 keys = new Keys();
72 config.setGroup( "Language" );
73 LANG = config.readEntry( "Language", "en" );
74 75
75 repeatTimer = new QTimer( this ); 76 repeatTimer = new QTimer( this );
76 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 77 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
77 78
78} 79}
79 80
80/* Keyboard::resizeEvent {{{1 */ 81/* Keyboard::resizeEvent {{{1 */
81void Keyboard::resizeEvent(QResizeEvent*) 82void Keyboard::resizeEvent(QResizeEvent*)
82{ 83{
83 int ph = picks->sizeHint().height(); 84 int ph = picks->sizeHint().height();
84 picks->setGeometry( 0, 0, width(), ph ); 85 picks->setGeometry( 0, 0, width(), ph );
85 keyHeight = (height()-(usePicks ? ph : 0))/5; 86 keyHeight = (height()-(usePicks ? ph : 0))/5;
86 87
87 int nk; // number of keys? 88 int nk; // number of keys?
88 if ( useLargeKeys ) { 89 if ( useLargeKeys ) {
89 nk = 15; 90 nk = 15;
90 } else { 91 } else {
91 nk = 19; 92 nk = 19;
92 } 93 }
93 defaultKeyWidth = (width()/nk)/2; 94 defaultKeyWidth = (width()/nk)/2;
94 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 95 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
95 96
96} 97}
97 98
98/* KeyboardPicks::initialize {{{1 */ 99/* KeyboardPicks::initialize {{{1 */
99void KeyboardPicks::initialise() 100void KeyboardPicks::initialise()
100{ 101{
101 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 102 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
102 mode = 0; 103 mode = 0;
103 dc = new KeyboardConfig(this); 104 dc = new KeyboardConfig(this);
104 configs.append(dc); 105 configs.append(dc);
105} 106}
106 107
107/* KeyboardPicks::sizeHint {{{1 */ 108/* KeyboardPicks::sizeHint {{{1 */
108QSize KeyboardPicks::sizeHint() const 109QSize KeyboardPicks::sizeHint() const
109{ 110{
110 return QSize(240,fontMetrics().lineSpacing()); 111 return QSize(240,fontMetrics().lineSpacing());
111} 112}
112 113
113 114
114/* KeyboardConfig::generateText {{{1 */ 115/* KeyboardConfig::generateText {{{1 */
115void KeyboardConfig::generateText(const QString &s) 116void KeyboardConfig::generateText(const QString &s)
116{ 117{
117#if defined(Q_WS_QWS) || defined(_WS_QWS_) 118#if defined(Q_WS_QWS) || defined(_WS_QWS_)
118 for (int i=0; i<(int)backspaces; i++) { 119 for (int i=0; i<(int)backspaces; i++) {
119 parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); 120 parent->emitKey( 0, Qt::Key_Backspace, 0, true, false );
120 parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); 121 parent->emitKey( 0, Qt::Key_Backspace, 0, false, false );
121 } 122 }
122 for (int i=0; i<(int)s.length(); i++) { 123 for (int i=0; i<(int)s.length(); i++) {
123 parent->emitKey( s[i].unicode(), 0, 0, true, false ); 124 parent->emitKey( s[i].unicode(), 0, 0, true, false );
124 parent->emitKey( s[i].unicode(), 0, 0, false, false ); 125 parent->emitKey( s[i].unicode(), 0, 0, false, false );
125 } 126 }
126 parent->emitKey( 0, Qt::Key_Space, 0, true, false ); 127 parent->emitKey( 0, Qt::Key_Space, 0, true, false );
127 parent->emitKey( 0, Qt::Key_Space, 0, false, false ); 128 parent->emitKey( 0, Qt::Key_Space, 0, false, false );
128 backspaces = 0; 129 backspaces = 0;
129#endif 130#endif
130} 131}
131 132
132 133
133 134
134 135
135/* Keyboard::paintEvent {{{1 */ 136/* Keyboard::paintEvent {{{1 */
136void Keyboard::paintEvent(QPaintEvent* e) 137void Keyboard::paintEvent(QPaintEvent* e)
137{ 138{
138 QPainter painter(this); 139 QPainter painter(this);
139 painter.setClipRect(e->rect()); 140 painter.setClipRect(e->rect());
140 drawKeyboard( painter ); 141 drawKeyboard( painter );
141 picks->dc->draw( &painter ); 142 picks->dc->draw( &painter );
142} 143}
143 144
144 145
145/* Keyboard::drawKeyboard {{{1 */ 146/* Keyboard::drawKeyboard {{{1 */
146 147
147void Keyboard::drawKeyboard(QPainter &p, int row, int col) 148void Keyboard::drawKeyboard(QPainter &p, int row, int col)
148{ 149{
149 QColor keycolor = 150 QColor keycolor =
150 QColor(240,240,240); 151 QColor(240,240,240);
151 QColor keycolor_pressed = QColor(171,183,198); 152 QColor keycolor_pressed = QColor(171,183,198);
152 QColor keycolor_lines = QColor(138,148,160); 153 QColor keycolor_lines = QColor(138,148,160);
153 QColor textcolor = QColor(43,54,68); 154 QColor textcolor = QColor(43,54,68);
154 155
155 156
156 if (row != -1 && col != -1) { //just redraw one key 157 if (row != -1 && col != -1) { //just redraw one key
157 158
158 int x = 0; 159 int x = 0;
159 for (int i = 0; i < col; i++) { 160 for (int i = 0; i < col; i++) {
160 161
161 x += keys.width(row, i) * defaultKeyWidth; 162 x += keys->width(row, i) * defaultKeyWidth;
162 } 163 }
163 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 164 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
164 165
165 int keyWidth = keys.width(row, col); 166 int keyWidth = keys->width(row, col);
166 167
167 p.fillRect(x + 1, y + 1, 168 p.fillRect(x + 1, y + 1,
168 keyWidth * defaultKeyWidth - 1, keyHeight - 1, 169 keyWidth * defaultKeyWidth - 1, keyHeight - 1,
169 pressed || keys.pressed(row, col) ? keycolor_pressed : keycolor); 170 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor);
170 171
171 QPixmap *pix = keys.pix(row,col); 172 QPixmap *pix = keys->pix(row,col);
172 173
173 ushort c = keys.uni(row, col); 174 ushort c = keys->uni(row, col);
174 175
175 if (!pix) { 176 if (!pix) {
176 p.setPen(textcolor); 177 p.setPen(textcolor);
177 p.drawText(x, y, 178 p.drawText(x, y,
178 defaultKeyWidth * keyWidth, keyHeight, 179 defaultKeyWidth * keyWidth, keyHeight,
179 AlignCenter, ((shift || lock) && keys.shift(c)) ? (QChar)keys.shift(c) : (QChar)c); 180 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c);
180 } 181 }
181 else 182 else
182 // center the image in the middle of the key 183 // center the image in the middle of the key
183 p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, 184 p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2,
184 y + (keyHeight - pix->height())/2 + 1, 185 y + (keyHeight - pix->height())/2 + 1,
185 *pix ); 186 *pix );
186 187
187 // this fixes the problem that the very right end of the board's vertical line 188 // this fixes the problem that the very right end of the board's vertical line
188 // gets painted over, because it's one pixel shorter than all other keys 189 // gets painted over, because it's one pixel shorter than all other keys
189 p.setPen(keycolor_lines); 190 p.setPen(keycolor_lines);
190 p.drawLine(width() - 1, 0, width() - 1, height()); 191 p.drawLine(width() - 1, 0, width() - 1, height());
191 192
192 } else { 193 } else {
193 194
194 195
195 p.fillRect(0, 0, width(), height(), keycolor); 196 p.fillRect(0, 0, width(), height(), keycolor);
196 197
197 for (row = 1; row <= 5; row++) { 198 for (row = 1; row <= 5; row++) {
198 199
199 int x = 0; 200 int x = 0;
200 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 201 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
201 202
202 p.setPen(keycolor_lines); 203 p.setPen(keycolor_lines);
203 p.drawLine(x, y, x + width(), y); 204 p.drawLine(x, y, x + width(), y);
204 205
205 for (int col = 0; col < keys.numKeys(row); col++) { 206 for (int col = 0; col < keys->numKeys(row); col++) {
206 207
207 QPixmap *pix = keys.pix(row, col); 208 QPixmap *pix = keys->pix(row, col);
208 int keyWidth = keys.width(row, col); 209 int keyWidth = keys->width(row, col);
209 210
210 211
211 int keyWidthPix = defaultKeyWidth * keyWidth; 212 int keyWidthPix = defaultKeyWidth * keyWidth;
212 213
213 if (keys.pressed(row, col)) 214 if (keys->pressed(row, col))
214 p.fillRect(x+1, y+1, keyWidthPix - 1, 215 p.fillRect(x+1, y+1, keyWidthPix - 1,
215 keyHeight - 1, keycolor_pressed); 216 keyHeight - 1, keycolor_pressed);
216 217
217 ushort c = keys.uni(row, col); 218 ushort c = keys->uni(row, col);
218 219
219 if (!pix) { 220 if (!pix) {
220 p.setPen(textcolor); 221 p.setPen(textcolor);
221 p.drawText(x, y, 222 p.drawText(x, y,
222 keyWidthPix, keyHeight, 223 keyWidthPix, keyHeight,
223 AlignCenter, ((shift || lock) && keys.shift(c)) ? (QChar)keys.shift(c) : (QChar)c); 224 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c);
224 } 225 }
225 else { 226 else {
226 // center the image in the middle of the key 227 // center the image in the middle of the key
227 p.drawPixmap( x + (keyWidthPix - pix->width())/2, 228 p.drawPixmap( x + (keyWidthPix - pix->width())/2,
228 y + (keyHeight - pix->height())/2 + 1, 229 y + (keyHeight - pix->height())/2 + 1,
229 QPixmap(*pix) ); 230 QPixmap(*pix) );
230 } 231 }
231 232
232 p.setPen(keycolor_lines); 233 p.setPen(keycolor_lines);
233 p.drawLine(x, y, x, y + keyHeight); 234 p.drawLine(x, y, x, y + keyHeight);
234 235
235 x += keyWidthPix; 236 x += keyWidthPix;
236 } 237 }
237 238
238 239
239 } 240 }
240 p.drawLine(0, height() - 1, width(), height() - 1); 241 p.drawLine(0, height() - 1, width(), height() - 1);
241 p.drawLine(width() - 1, 0, width() - 1, height()); 242 p.drawLine(width() - 1, 0, width() - 1, height());
242 } 243 }
243 244
244} 245}
245 246
246 247
247/* Keyboard::mousePressEvent {{{1 */ 248/* Keyboard::mousePressEvent {{{1 */
248void Keyboard::mousePressEvent(QMouseEvent *e) 249void Keyboard::mousePressEvent(QMouseEvent *e)
249{ 250{
250 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; 251 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
251 if (row > 5) row = 5; 252 if (row > 5) row = 5;
252 253
253 // figure out the column 254 // figure out the column
254 int col = 0; 255 int col = 0;
255 for (int w = 0; e->x() >= w; col++) 256 for (int w = 0; e->x() >= w; col++)
256 if (col < keys.numKeys(row)) // it segfaults if it trys to read past numKeys 257 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
257 w += keys.width(row,col) * defaultKeyWidth; 258 w += keys->width(row,col) * defaultKeyWidth;
258 else break; 259 else break;
259 260
260 col --; // rewind one... 261 col --; // rewind one...
261 262
262 qkeycode = keys.qcode(row, col); 263 qkeycode = keys->qcode(row, col);
263 unicode = keys.uni(row, col); 264 unicode = keys->uni(row, col);
264 265
265 // might need to repaint if two or more of the same keys. 266 // might need to repaint if two or more of the same keys.
266 // should be faster if just paint one key even though multiple keys exist. 267 // should be faster if just paint one key even though multiple keys exist.
267 bool need_repaint = FALSE; 268 bool need_repaint = FALSE;
268 269
269 if (unicode == 0) { // either Qt char, or nothing 270 if (unicode == 0) { // either Qt char, or nothing
270 271
271 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 272 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
272 273
273 if ( configdlg ) { 274 if ( configdlg ) {
274 delete (ConfigDlg *) configdlg; 275 delete (ConfigDlg *) configdlg;
275 configdlg = 0; 276 configdlg = 0;
276 } 277 }
277 else { 278 else {
278 configdlg = new ConfigDlg (); 279 configdlg = new ConfigDlg ();
279 connect(configdlg, SIGNAL(pickboardToggled(bool)), 280 connect(configdlg, SIGNAL(pickboardToggled(bool)),
280 this, SLOT(togglePickboard(bool))); 281 this, SLOT(togglePickboard(bool)));
282 connect(configdlg, SIGNAL(setMapToDefault()),
283 this, SLOT(setMapToDefault()));
284 connect(configdlg, SIGNAL(setMapToFile(QString)),
285 this, SLOT(setMapToFile(QString)));
281 configdlg->showMaximized(); 286 configdlg->showMaximized();
282 configdlg->show(); 287 configdlg->show();
283 configdlg->raise(); 288 configdlg->raise();
284 } 289 }
285 290
286 } else if (qkeycode == Qt::Key_Control) { 291 } else if (qkeycode == Qt::Key_Control) {
287 ctrl = keys.pressedPtr(row, col); 292 ctrl = keys->pressedPtr(row, col);
288 need_repaint = TRUE; 293 need_repaint = TRUE;
289 *ctrl = !keys.pressed(row, col); 294 *ctrl = !keys->pressed(row, col);
290 295
291 } else if (qkeycode == Qt::Key_Alt) { 296 } else if (qkeycode == Qt::Key_Alt) {
292 alt = keys.pressedPtr(row, col); 297 alt = keys->pressedPtr(row, col);
293 need_repaint = TRUE; 298 need_repaint = TRUE;
294 *alt = !keys.pressed(row, col); 299 *alt = !keys->pressed(row, col);
295 300
296 } else if (qkeycode == Qt::Key_Shift) { 301 } else if (qkeycode == Qt::Key_Shift) {
297 need_repaint = TRUE; 302 need_repaint = TRUE;
298 303
299 if (shift) { 304 if (shift) {
300 *shift = 0; 305 *shift = 0;
301 shift = 0; 306 shift = 0;
302 } 307 }
303 else { 308 else {
304 shift = keys.pressedPtr(row, col); 309 shift = keys->pressedPtr(row, col);
305 *shift = 1; 310 *shift = 1;
306 if (lock) { 311 if (lock) {
307 *lock = 0; 312 *lock = 0;
308 lock = 0; 313 lock = 0;
309 } 314 }
310 } 315 }
311 316
312 } else if (qkeycode == Qt::Key_CapsLock) { 317 } else if (qkeycode == Qt::Key_CapsLock) {
313 need_repaint = TRUE; 318 need_repaint = TRUE;
314 319
315 if (lock) { 320 if (lock) {
316 *lock = 0; 321 *lock = 0;
317 lock = 0; 322 lock = 0;
318 } 323 }
319 else { 324 else {
320 lock = keys.pressedPtr(row, col);; 325 lock = keys->pressedPtr(row, col);;
321 *lock = 1; 326 *lock = 1;
322 if (shift) { 327 if (shift) {
323 *shift = 0; 328 *shift = 0;
324 shift = 0; 329 shift = 0;
325 } 330 }
326 } 331 }
327 332
328 } 333 }
329 334
330 } 335 }
331 else { // normal char 336 else { // normal char
332 if ((shift || lock) && keys.shift(unicode)) { 337 if ((shift || lock) && keys->shift(unicode)) {
333 unicode = keys.shift(unicode); 338 unicode = keys->shift(unicode);
334 } 339 }
335 } 340 }
336 341
337 // korean parsing 342 // korean parsing
338 if (LANG == "ko") { 343 if (keys->lang == "ko") {
339 344
340 unicode = parseKoreanInput(unicode); 345 unicode = parseKoreanInput(unicode);
341 } 346 }
342 347
343 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); 348 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0);
344 349
345 emit key(unicode, qkeycode, modifiers, true, false); 350 emit key(unicode, qkeycode, modifiers, true, false);
346 351
347 // pickboard stuff 352 // pickboard stuff
348 if (usePicks) { 353 if (usePicks) {
349 354
350 KeyboardConfig *dc = picks->dc; 355 KeyboardConfig *dc = picks->dc;
351 356
352 if (dc) { 357 if (dc) {
353 if (qkeycode == Qt::Key_Backspace) { 358 if (qkeycode == Qt::Key_Backspace) {
354 dc->input.remove(dc->input.last()); // remove last input 359 dc->input.remove(dc->input.last()); // remove last input
355 dc->decBackspaces(); 360 dc->decBackspaces();
356 } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) { 361 } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) {
357 dc->input.clear(); 362 dc->input.clear();
358 dc->resetBackspaces(); 363 dc->resetBackspaces();
359 } else { 364 } else {
360 dc->add(QString(QChar(unicode))); 365 dc->add(QString(QChar(unicode)));
361 dc->incBackspaces(); 366 dc->incBackspaces();
362 } 367 }
363 } 368 }
364 picks->repaint(); 369 picks->repaint();
365 } 370 }
366 371
367 372
368 // painting 373 // painting
369 pressed = TRUE; 374 pressed = TRUE;
370 375
371 pressedKeyRow = row; 376 pressedKeyRow = row;
372 pressedKeyCol = col; 377 pressedKeyCol = col;
373 378
374 if (need_repaint) repaint(FALSE); 379 if (need_repaint) repaint(FALSE);
375 else { // just paint the one key pressed 380 else { // just paint the one key pressed
376 381
377 382
378 383
379 QPainter p(this); 384 QPainter p(this);
380 drawKeyboard(p, row, col); 385 drawKeyboard(p, row, col);
381 386
382 } 387 }
383 388
384 pressTid = startTimer(80); 389 pressTid = startTimer(80);
385 390
386} 391}
387 392
388 393
389/* Keyboard::mouseReleaseEvent {{{1 */ 394/* Keyboard::mouseReleaseEvent {{{1 */
390void Keyboard::mouseReleaseEvent(QMouseEvent*) 395void Keyboard::mouseReleaseEvent(QMouseEvent*)
391{ 396{
392 pressed = FALSE; 397 pressed = FALSE;
393 if ( pressTid == 0 ) 398 if ( pressTid == 0 )
394#if defined(Q_WS_QWS) || defined(_WS_QWS_) 399#if defined(Q_WS_QWS) || defined(_WS_QWS_)
395 if ( unicode != -1 ) { 400 if ( unicode != -1 ) {
396 emit key( unicode, qkeycode, modifiers, false, false ); 401 emit key( unicode, qkeycode, modifiers, false, false );
397 repeatTimer->stop(); 402 repeatTimer->stop();
398 } 403 }
399#endif 404#endif
400 if (shift && unicode != 0) { 405 if (shift && unicode != 0) {
401 406
402 407
403 *shift = 0; // unpress shift key 408 *shift = 0; // unpress shift key
404 shift = 0; // reset the shift pointer 409 shift = 0; // reset the shift pointer
405 repaint(FALSE); 410 repaint(FALSE);
406 411
407 } 412 }
408 else 413 else
409 414
410 clearHighlight(); 415 clearHighlight();
411} 416}
412 417
413/* Keyboard::timerEvent {{{1 */ 418/* Keyboard::timerEvent {{{1 */
414/* 419/*
415void Keyboard::timerEvent(QTimerEvent* e) 420void Keyboard::timerEvent(QTimerEvent* e)
416{ 421{
417 if ( e->timerId() == pressTid ) { 422 if ( e->timerId() == pressTid ) {
418 killTimer(pressTid); 423 killTimer(pressTid);
419 pressTid = 0; 424 pressTid = 0;
420 if ( !pressed ) 425 if ( !pressed )
421 cout << "calling clearHighlight from timerEvent\n"; 426 cout << "calling clearHighlight from timerEvent\n";
422 clearHighlight(); 427 clearHighlight();
423 } 428 }
424} 429}
425*/ 430*/
426 431
427void Keyboard::repeat() 432void Keyboard::repeat()
428{ 433{
429 434
430 repeatTimer->start( 200 ); 435 repeatTimer->start( 200 );
431 emit key( unicode, 0, modifiers, true, true ); 436 emit key( unicode, 0, modifiers, true, true );
432} 437}
433 438
434void Keyboard::clearHighlight() 439void Keyboard::clearHighlight()
435{ 440{
436 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) { 441 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) {
437 int tmpRow = pressedKeyRow; 442 int tmpRow = pressedKeyRow;
438 int tmpCol = pressedKeyCol; 443 int tmpCol = pressedKeyCol;
439 444
440 pressedKeyRow = -1; 445 pressedKeyRow = -1;
441 pressedKeyCol = -1; 446 pressedKeyCol = -1;
442 447
443 QPainter p(this); 448 QPainter p(this);
444 drawKeyboard(p, tmpRow, tmpCol); 449 drawKeyboard(p, tmpRow, tmpCol);
445 } 450 }
446} 451}
447 452
448 453
449/* Keyboard::sizeHint {{{1 */ 454/* Keyboard::sizeHint {{{1 */
450QSize Keyboard::sizeHint() const 455QSize Keyboard::sizeHint() const
451{ 456{
452 QFontMetrics fm=fontMetrics(); 457 QFontMetrics fm=fontMetrics();
453 int keyHeight = fm.lineSpacing(); 458 int keyHeight = fm.lineSpacing();
454 459
455 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); 460 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1);
456} 461}
457 462
458 463
459void Keyboard::resetState() 464void Keyboard::resetState()
460{ 465{
461 schar = mchar = echar = 0; 466 schar = mchar = echar = 0;
462 picks->resetState(); 467 picks->resetState();
463} 468}
464 469
465/* Keyboard::togglePickboard {{{1 */ 470/* Keyboard::togglePickboard {{{1 */
466void Keyboard::togglePickboard(bool on_off) 471void Keyboard::togglePickboard(bool on_off)
467{ 472{
468 usePicks = on_off; 473 usePicks = on_off;
469 if (usePicks) { 474 if (usePicks) {
470 picks->show(); 475 picks->show();
471 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send 476 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send
472 //adjustSize(); 477 //adjustSize();
473 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 478 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
474 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 479 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
475 } else { 480 } else {
476 481
477 picks->hide(); 482 picks->hide();
478 picks->resetState(); 483 picks->resetState();
479 //move(x(), y() + picks->height()); 484 //move(x(), y() + picks->height());
480 //adjustSize(); 485 //adjustSize();
481 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 486 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
482 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 487 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
483 488
484 } 489 }
485 /* 490 /*
486 * this closes && opens the input method 491 * this closes && opens the input method
487 */ 492 */
488 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); 493 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
489 QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); 494 QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
490} 495}
491 496
497/* Keyboard::setMapTo ... {{{1 */
498void Keyboard::setMapToDefault() {
499
500
501 /* load current locale language map */
502 Config *config = new Config("locale");
503 config->setGroup( "Language" );
504 QString l = config->readEntry( "Language" , "en" );
505 delete config;
506
507 QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
508 + l + ".keymap";
509
510 /* save change to multikey config file */
511 config = new Config("multikey");
512 config->setGroup ("keymaps");
513 config->writeEntry ("current", key_map); // default closed
514 delete config;
515
516 delete keys;
517 keys = new Keys(key_map);
518
519 // have to repaint the keyboard
520 repaint(FALSE);
521}
522
523void Keyboard::setMapToFile(QString file) {
524
525 /* save change to multikey config file */
526 Config *config = new Config("multikey");
527 config->setGroup ("keymaps");
528 config->writeEntry ("current", file); // default closed
529 delete config;
530
531 delete keys;
532 keys = new Keys(file);
533 repaint(FALSE);
534
535}
536
492/* korean input functions {{{1 537/* korean input functions {{{1
493 * 538 *
494 * TODO 539 * TODO
495 * one major problem with this implementation is that you can't move the 540 * one major problem with this implementation is that you can't move the
496 * cursor after inputing korean chars, otherwise it will eat up and replace 541 * cursor after inputing korean chars, otherwise it will eat up and replace
497 * the char before the cursor you move to. fix that 542 * the char before the cursor you move to. fix that
498 * 543 *
499 * make backspace delete one single char, not the whole thing if still 544 * make backspace delete one single char, not the whole thing if still
500 * editing. 545 * editing.
501 * 546 *
502 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 547 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
503 * 548 *
504 * how korean input works 549 * how korean input works
505 * 550 *
506 * all following chars means unicode char value and are in hex 551 * all following chars means unicode char value and are in hex
507 * 552 *
508 * ÃÊÀ½ = schar (start char) 553 * ÃÊÀ½ = schar (start char)
509 * ÁßÀ½ = mchar (middle char) 554 * ÁßÀ½ = mchar (middle char)
510 * ³¡À½ = echar (end char) 555 * ³¡À½ = echar (end char)
511 * 556 *
512 * there are 19 schars. unicode position is at 1100 - 1112 557 * there are 19 schars. unicode position is at 1100 - 1112
513 * there are 21 mchars. unicode position is at 1161 - 1175 558 * there are 21 mchars. unicode position is at 1161 - 1175
514 * there are 27 echars. unicode position is at 11a8 - 11c2 559 * there are 27 echars. unicode position is at 11a8 - 11c2
515 * 560 *
516 * the map with everything combined is at ac00 - d7a3 561 * the map with everything combined is at ac00 - d7a3
517 * 562 *
518 */ 563 */
519 564
520ushort Keyboard::parseKoreanInput (ushort c) { 565ushort Keyboard::parseKoreanInput (ushort c) {
521 566
522 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) 567 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c))
523 || 568 ||
524 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode 569 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode
525 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { 570 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) {
526 571
527 schar = 0, mchar = 0, echar = 0; 572 schar = 0, mchar = 0, echar = 0;
528 return c; 573 return c;
529 } 574 }
530 575
531 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input 576 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input
532 577
533 if (schar == 0 || (schar != 0 && mchar == 0)) { 578 if (schar == 0 || (schar != 0 && mchar == 0)) {
534 schar = c; mchar = 0; echar = 0; 579 schar = c; mchar = 0; echar = 0;
535 return c; 580 return c;
536 } 581 }
537 else if (mchar != 0) { 582 else if (mchar != 0) {
538 583
539 if (echar == 0) { 584 if (echar == 0) {
540 585
541 if (!(echar = constoe(c))) { 586 if (!(echar = constoe(c))) {
542 587
543 schar = c; mchar = 0; echar = 0; 588 schar = c; mchar = 0; echar = 0;
544 return c; 589 return c;
545 } 590 }
546 591
547 } 592 }
548 else { // must figure out what the echar is 593 else { // must figure out what the echar is
549 594
550 if (echar == 0x11a8) { // ¤¡ 595 if (echar == 0x11a8) { // ¤¡
551 596
552 if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡ 597 if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡
553 else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ 598 else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ
554 else { 599 else {
555 schar = c; mchar = 0; echar = 0; 600 schar = c; mchar = 0; echar = 0;
556 return c; 601 return c;
557 } 602 }
558 603
559 } else if (echar == 0x11ab) { // ¤¤ 604 } else if (echar == 0x11ab) { // ¤¤
560 605
561 if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸ 606 if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸
562 else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾ 607 else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾
563 else { 608 else {
564 schar = c; mchar = 0; echar = 0; 609 schar = c; mchar = 0; echar = 0;
565 return c; 610 return c;
566 } 611 }
567 612
568 } else if (echar == 0x11af) { // ¤© 613 } else if (echar == 0x11af) { // ¤©
569 614
570 if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡ 615 if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡
571 else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤± 616 else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤±
572 else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤² 617 else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤²
573 else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ 618 else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ
574 else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼ 619 else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼
575 else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½ 620 else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½
576 else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾ 621 else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾
577 else { 622 else {
578 schar = c; mchar = 0; echar = 0; 623 schar = c; mchar = 0; echar = 0;
579 return c; 624 return c;
580 } 625 }
581 626
582 } else if (echar == 0x11b8) { // ¤² 627 } else if (echar == 0x11b8) { // ¤²
583 628
584 if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ 629 if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ
585 else { 630 else {
586 schar = c; mchar = 0; echar = 0; 631 schar = c; mchar = 0; echar = 0;
587 return c; 632 return c;
@@ -702,282 +747,315 @@ ushort Keyboard::parseKoreanInput (ushort c) {
702 if (constoe(echar)) { 747 if (constoe(echar)) {
703 748
704 prev = combineKoreanChars(schar, mchar, 0); 749 prev = combineKoreanChars(schar, mchar, 0);
705 schar = constoe(echar); 750 schar = constoe(echar);
706 } 751 }
707 break; 752 break;
708 } 753 }
709 754
710 emit key( prev, prev, 0, true, false ); 755 emit key( prev, prev, 0, true, false );
711 756
712 mchar = c; echar = 0; 757 mchar = c; echar = 0;
713 758
714 return combineKoreanChars(schar, mchar, 0); 759 return combineKoreanChars(schar, mchar, 0);
715 760
716 } 761 }
717 else { 762 else {
718 schar = 0; mchar = 0; echar = 0; 763 schar = 0; mchar = 0; echar = 0;
719 return c; 764 return c;
720 } 765 }
721 766
722 } 767 }
723 else /*if (c == ' ')*/ return c; 768 else /*if (c == ' ')*/ return c;
724 769
725 770
726 // and now... finally delete previous char, and return new char 771 // and now... finally delete previous char, and return new char
727 emit key( 8, Qt::Key_Backspace, 0, true, false ); 772 emit key( 8, Qt::Key_Backspace, 0, true, false );
728 773
729 774
730 return combineKoreanChars( schar, mchar, echar); 775 return combineKoreanChars( schar, mchar, echar);
731 776
732} 777}
733 778
734ushort Keyboard::combineKoreanChars(const ushort s, const ushort m, const ushort e) { 779ushort Keyboard::combineKoreanChars(const ushort s, const ushort m, const ushort e) {
735 780
736 return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00; 781 return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00;
737 782
738} 783}
739 784
740ushort Keyboard::constoe(const ushort c) { 785ushort Keyboard::constoe(const ushort c) {
741 786
742 // converts schars to echars if possible 787 // converts schars to echars if possible
743 788
744 if (0x1100 <= c && c <= 0x1112) { // schar to echar 789 if (0x1100 <= c && c <= 0x1112) { // schar to echar
745 790
746 switch (c) { 791 switch (c) {
747 case 0x1100: return 0x11a8; 792 case 0x1100: return 0x11a8;
748 case 0x1101: return 0x11a9; 793 case 0x1101: return 0x11a9;
749 case 0x1102: return 0x11ab; 794 case 0x1102: return 0x11ab;
750 case 0x1103: return 0x11ae; 795 case 0x1103: return 0x11ae;
751 case 0x1105: return 0x11af; 796 case 0x1105: return 0x11af;
752 case 0x1106: return 0x11b7; 797 case 0x1106: return 0x11b7;
753 case 0x1107: return 0x11b8; 798 case 0x1107: return 0x11b8;
754 case 0x1109: return 0x11ba; 799 case 0x1109: return 0x11ba;
755 case 0x110a: return 0x11bb; 800 case 0x110a: return 0x11bb;
756 case 0x110b: return 0x11bc; 801 case 0x110b: return 0x11bc;
757 case 0x110c: return 0x11bd; 802 case 0x110c: return 0x11bd;
758 case 0x110e: return 0x11be; 803 case 0x110e: return 0x11be;
759 case 0x110f: return 0x11bf; 804 case 0x110f: return 0x11bf;
760 case 0x1110: return 0x11c0; 805 case 0x1110: return 0x11c0;
761 case 0x1111: return 0x11c1; 806 case 0x1111: return 0x11c1;
762 case 0x1112: return 0x11c2; 807 case 0x1112: return 0x11c2;
763 default: return 0; 808 default: return 0;
764 809
765 } 810 }
766 811
767 } else { //echar to schar 812 } else { //echar to schar
768 813
769 switch (c) { 814 switch (c) {
770 case 0x11a8: return 0x1100; 815 case 0x11a8: return 0x1100;
771 case 0x11a9: return 0x1101; 816 case 0x11a9: return 0x1101;
772 case 0x11ab: return 0x1102; 817 case 0x11ab: return 0x1102;
773 case 0x11ae: return 0x1103; 818 case 0x11ae: return 0x1103;
774 case 0x11af: return 0x1105; 819 case 0x11af: return 0x1105;
775 case 0x11b7: return 0x1106; 820 case 0x11b7: return 0x1106;
776 case 0x11b8: return 0x1107; 821 case 0x11b8: return 0x1107;
777 case 0x11ba: return 0x1109; 822 case 0x11ba: return 0x1109;
778 case 0x11bb: return 0x110a; 823 case 0x11bb: return 0x110a;
779 case 0x11bc: return 0x110b; 824 case 0x11bc: return 0x110b;
780 case 0x11bd: return 0x110c; 825 case 0x11bd: return 0x110c;
781 case 0x11be: return 0x110e; 826 case 0x11be: return 0x110e;
782 case 0x11bf: return 0x110f; 827 case 0x11bf: return 0x110f;
783 case 0x11c0: return 0x1110; 828 case 0x11c0: return 0x1110;
784 case 0x11c1: return 0x1111; 829 case 0x11c1: return 0x1111;
785 case 0x11c2: return 0x1112; 830 case 0x11c2: return 0x1112;
786 default: return 0; 831 default: return 0;
787 832
788 } 833 }
789 834
790 } 835 }
791} 836}
792 837
793 838
794// Keys::Keys {{{1 839// Keys::Keys {{{1
795 840
796Keys::Keys() { 841Keys::Keys() {
797 842
798 Config config("locale"); 843 Config *config = new Config ("multikey");
799 config.setGroup( "Language" ); 844 config->setGroup( "keymaps" );
800 QString l = config.readEntry( "Language" , "en" ); 845 QString key_map = config->readEntry( "current" );
846 delete config;
847
848 if (key_map.isNull()) {
849
850 Config *config = new Config("locale");
851 config->setGroup( "Language" );
852 QString l = config->readEntry( "Language" , "en" );
853 delete config;
854
855 key_map = QPEApplication::qpeDir() + "/share/multikey/"
856 + l + ".keymap";
857
858 }
801 859
802 QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
803 + l + ".keymap";
804 860
805 setKeysFromFile(key_map); 861 setKeysFromFile(key_map);
806} 862}
807 863
808Keys::Keys(const char * filename) { 864Keys::Keys(const char * filename) {
809 865
810 setKeysFromFile(filename); 866 setKeysFromFile(filename);
811} 867}
812 868
813// Keys::setKeysFromFile {{{2 869// Keys::setKeysFromFile {{{2
814void Keys::setKeysFromFile(const char * filename) { 870void Keys::setKeysFromFile(const char * filename) {
815 871
816 QFile f(filename); 872 QFile f(filename);
817 873
818 if (f.open(IO_ReadOnly)) { 874 if (f.open(IO_ReadOnly)) {
819 875
820 QTextStream t(&f); 876 QTextStream t(&f);
821 int row; 877 int row;
822 int qcode; 878 int qcode;
823 ushort unicode; 879 ushort unicode;
824 int width; 880 int width;
825 QString buf; 881 QString buf;
826 QString comment; 882 QString comment;
827 char * xpm[256]; //couldnt be larger than that... could it? 883 char * xpm[256]; //couldnt be larger than that... could it?
828 QPixmap *xpm2pix = 0; 884 QPixmap *xpm2pix = 0;
829 885
830 buf = t.readLine(); 886 buf = t.readLine();
831 while (buf) { 887 while (buf) {
832 888
889 // key definition
833 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) { 890 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) {
834 // no $1 type referencing!!! this implementation of regexp sucks 891 // no $1 type referencing!!! this implementation of regexp sucks
835 892
836 // dont know of any sscanf() type funcs in Qt lib 893 // dont know of any sscanf() type funcs in Qt lib
837 QTextStream tmp (buf, IO_ReadOnly); 894 QTextStream tmp (buf, IO_ReadOnly);
838 tmp >> row >> qcode >> unicode >> width >> comment; 895 tmp >> row >> qcode >> unicode >> width >> comment;
839 896
840 buf = t.readLine(); 897 buf = t.readLine();
841 int xpmLineCount = 0; 898 int xpmLineCount = 0;
842 xpm2pix = 0; 899 xpm2pix = 0;
843 900
844 // erase blank space 901 // erase blank space
845 while (buf.contains(QRegExp("^\\s*$")) && buf) buf = t.readLine(); 902 while (buf.contains(QRegExp("^\\s*$")) && buf) buf = t.readLine();
846 903
847 while (buf.contains(QRegExp("^\\s*\".*\""))) { 904 while (buf.contains(QRegExp("^\\s*\".*\""))) {
848 905
849 QString xpmBuf = buf.stripWhiteSpace(); 906 QString xpmBuf = buf.stripWhiteSpace();
850 907
851 xpm[xpmLineCount] = new char [xpmBuf.length()]; 908 xpm[xpmLineCount] = new char [xpmBuf.length()];
852 909
853 int j = 0; 910 int j = 0;
854 for (ushort i = 0; i < xpmBuf.length(); i++) { 911 for (ushort i = 0; i < xpmBuf.length(); i++) {
855 if (xpmBuf[i].latin1() != '"') { 912 if (xpmBuf[i].latin1() != '"') {
856 913
857 ((char *)xpm[xpmLineCount])[j] = xpmBuf.at(i).latin1(); 914 ((char *)xpm[xpmLineCount])[j] = xpmBuf.at(i).latin1();
858 j++; 915 j++;
859 } 916 }
860 917
861 } 918 }
862 // have to close that facker up 919 // have to close that facker up
863 ((char *)xpm[xpmLineCount])[j] = '\0'; 920 ((char *)xpm[xpmLineCount])[j] = '\0';
864 921
865 xpmLineCount++; 922 xpmLineCount++;
866 buf = t.readLine(); 923 buf = t.readLine();
867 } 924 }
868 if (xpmLineCount) { 925 if (xpmLineCount) {
869 926
870 xpm2pix = new QPixmap((const char **)xpm); 927 xpm2pix = new QPixmap((const char **)xpm);
871 for (int i = 0; i < xpmLineCount; i++) 928 for (int i = 0; i < xpmLineCount; i++)
872 929
873 delete [] (xpm[i]); 930 delete [] (xpm[i]);
874 931
875 } 932 }
876 setKey(row, qcode, unicode, width, xpm2pix); 933 setKey(row, qcode, unicode, width, xpm2pix);
877 } 934 }
935
936 // shift map
878 else if (buf.contains(QRegExp("^[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { 937 else if (buf.contains(QRegExp("^[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) {
879 938
880 QTextStream tmp (buf, IO_ReadOnly); 939 QTextStream tmp (buf, IO_ReadOnly);
881 ushort lower, shift; 940 ushort lower, shift;
882 tmp >> lower >> shift; 941 tmp >> lower >> shift;
883 942
884 shiftMap.insert(lower, shift); 943 shiftMap.insert(lower, shift);
885 944
886 buf = t.readLine(); 945 buf = t.readLine();
887 } 946 }
947
948 // other variables like lang & title
949 else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) {
950
951 QTextStream tmp (buf, IO_ReadOnly);
952 QString name, equals, value;
953
954 tmp >> name >> equals >> value;
955
956 if (name == "lang") {
957
958 lang = value;
959
960 }
961
962 cout << name << " = " << value << "\n";
963 buf = t.readLine();
964 }
965 // comments
888 else if (buf.contains(QRegExp("^\\s*#"))) { 966 else if (buf.contains(QRegExp("^\\s*#"))) {
889 967
890 buf = t.readLine(); 968 buf = t.readLine();
891 969
892 } else { // blank line, or garbage 970 } else { // blank line, or garbage
893 971
894 buf = t.readLine(); 972 buf = t.readLine();
895 973
896 } 974 }
897 975
898 } 976 }
899 f.close(); 977 f.close();
900 } 978 }
901 979
902} 980}
903 981
904// Keys::setKey {{{2 982// Keys::setKey {{{2
905void Keys::setKey(const int row, const int qcode, const ushort unicode, 983void Keys::setKey(const int row, const int qcode, const ushort unicode,
906 const int width, QPixmap *pix) { 984 const int width, QPixmap *pix) {
907 985
908 Key * key; 986 Key * key;
909 key = new Key; 987 key = new Key;
910 key->qcode = qcode; 988 key->qcode = qcode;
911 key->unicode = unicode; 989 key->unicode = unicode;
912 key->width = width; 990 key->width = width;
913 991
914 // share key->pressed between same keys 992 // share key->pressed between same keys
915 bool found = 0; 993 bool found = 0;
916 for (int i = 1; i <= 5; i++) { 994 for (int i = 1; i <= 5; i++) {
917 for (unsigned int j = 0; j < keys[i].count(); j++) 995 for (unsigned int j = 0; j < keys[i].count(); j++)
918 if (keys[i].at(j)->qcode == qcode && keys[i].at(j)->unicode == unicode) { 996 if (keys[i].at(j)->qcode == qcode && keys[i].at(j)->unicode == unicode) {
919 997
920 key->pressed = keys[i].at(j)->pressed; 998 key->pressed = keys[i].at(j)->pressed;
921 found = 1; 999 found = 1;
922 } 1000 }
923 1001
924 } 1002 }
925 if (!found) { 1003 if (!found) {
926 1004
927 key->pressed = new bool; 1005 key->pressed = new bool;
928 *(key->pressed) = 0; 1006 *(key->pressed) = 0;
929 } 1007 }
930 1008
931 key->pix = pix; 1009 key->pix = pix;
932 1010
933 1011
934 keys[row].append(key); 1012 keys[row].append(key);
935} 1013}
936// Keys:: other functions {{{2 1014// Keys:: other functions {{{2
937int Keys::width(const int row, const int col) { 1015int Keys::width(const int row, const int col) {
938 1016
939 return keys[row].at(col)->width; 1017 return keys[row].at(col)->width;
940 1018
941} 1019}
942ushort Keys::uni(const int row, const int col) { 1020ushort Keys::uni(const int row, const int col) {
943 1021
944 return keys[row].at(col)->unicode; 1022 return keys[row].at(col)->unicode;
945 1023
946} 1024}
947 1025
948int Keys::qcode(const int row, const int col) { 1026int Keys::qcode(const int row, const int col) {
949 1027
950 return keys[row].at(col)->qcode; 1028 return keys[row].at(col)->qcode;
951} 1029}
952 1030
953QPixmap *Keys::pix(const int row, const int col) { 1031QPixmap *Keys::pix(const int row, const int col) {
954 1032
955 return keys[row].at(col)->pix; 1033 return keys[row].at(col)->pix;
956 1034
957} 1035}
958bool Keys::pressed(const int row, const int col) { 1036bool Keys::pressed(const int row, const int col) {
959 1037
960 return *(keys[row].at(col)->pressed); 1038 return *(keys[row].at(col)->pressed);
961} 1039}
962 1040
963int Keys::numKeys(const int row) { 1041int Keys::numKeys(const int row) {
964 1042
965 return keys[row].count(); 1043 return keys[row].count();
966} 1044}
967 1045
968void Keys::setPressed(const int row, const int col, const bool pressed) { 1046void Keys::setPressed(const int row, const int col, const bool pressed) {
969 1047
970 *(keys[row].at(col)->pressed) = pressed; 1048 *(keys[row].at(col)->pressed) = pressed;
971} 1049}
972 1050
973ushort Keys::shift(const ushort uni) { 1051ushort Keys::shift(const ushort uni) {
974 1052
975 if (shiftMap[uni]) { 1053 if (shiftMap[uni]) {
976 1054
977 return shiftMap[uni]; 1055 return shiftMap[uni];
978 } 1056 }
979 else 1057 else
980 return 0; 1058 return 0;
981 1059
982} 1060}
983 1061
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index e61b76c..c2efe10 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -1,152 +1,156 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qframe.h> 20#include <qframe.h>
21#include <qmap.h> 21#include <qmap.h>
22#include "../pickboard/pickboardcfg.h" 22#include "../pickboard/pickboardcfg.h"
23#include "../pickboard/pickboardpicks.h" 23#include "../pickboard/pickboardpicks.h"
24#include "configdlg.h" 24#include "configdlg.h"
25 25
26class QTimer; 26class QTimer;
27 27
28class KeyboardConfig : public DictFilterConfig 28class KeyboardConfig : public DictFilterConfig
29{ 29{
30public: 30public:
31 KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } 31 KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; }
32 virtual void generateText(const QString &s); 32 virtual void generateText(const QString &s);
33 void decBackspaces() { if (backspaces) backspaces--; } 33 void decBackspaces() { if (backspaces) backspaces--; }
34 void incBackspaces() { backspaces++; } 34 void incBackspaces() { backspaces++; }
35 void resetBackspaces() { backspaces = 0; } 35 void resetBackspaces() { backspaces = 0; }
36private: 36private:
37 int backspaces; 37 int backspaces;
38}; 38};
39 39
40 40
41class KeyboardPicks : public PickboardPicks 41class KeyboardPicks : public PickboardPicks
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) 45 KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0)
46 : PickboardPicks(parent, name, f) { } 46 : PickboardPicks(parent, name, f) { }
47 void initialise(); 47 void initialise();
48 virtual QSize sizeHint() const; 48 virtual QSize sizeHint() const;
49 KeyboardConfig *dc; 49 KeyboardConfig *dc;
50}; 50};
51 51
52 52
53class Keys { 53class Keys {
54public: 54public:
55 55
56 Keys(); 56 Keys();
57 Keys(const char * filename); 57 Keys(const char * filename);
58 ushort uni(const int row, const int col); 58 ushort uni(const int row, const int col);
59 int qcode(const int row, const int col); 59 int qcode(const int row, const int col);
60 int width(const int row, const int col); 60 int width(const int row, const int col);
61 bool pressed(const int row, const int col); 61 bool pressed(const int row, const int col);
62 bool *pressedPtr(const int row, const int col); 62 bool *pressedPtr(const int row, const int col);
63 ushort shift(const ushort); 63 ushort shift(const ushort);
64 QPixmap *pix(const int row, const int col); 64 QPixmap *pix(const int row, const int col);
65 int numKeys(const int row); 65 int numKeys(const int row);
66 void setKeysFromFile(const char *filename); 66 void setKeysFromFile(const char *filename);
67 void setKey(const int row, const int qcode, const ushort unicode, 67 void setKey(const int row, const int qcode, const ushort unicode,
68 const int width, QPixmap *pix); 68 const int width, QPixmap *pix);
69 void setPressed(const int row, const int col, const bool pressed); 69 void setPressed(const int row, const int col, const bool pressed);
70 QString lang;
71 QString title;
70 72
71private: 73private:
72 74
73 typedef struct Key { 75 typedef struct Key {
74 int qcode; // are qt key codes just unicode values? 76 int qcode; // are qt key codes just unicode values?
75 ushort unicode; 77 ushort unicode;
76 int width; // not pixels but relative key width. normal key is 2 78 int width; // not pixels but relative key width. normal key is 2
77 79
78 // only needed for keys like ctrl that can have multiple keys pressed at once 80 // only needed for keys like ctrl that can have multiple keys pressed at once
79 bool *pressed; 81 bool *pressed;
80 QPixmap *pix; 82 QPixmap *pix;
81 }; 83 };
82 84
83 QList<Key> keys[6]; 85 QList<Key> keys[6];
84 QMap<ushort,ushort> shiftMap; 86 QMap<ushort,ushort> shiftMap;
85 87
86}; 88};
87 89
88class Keyboard : public QFrame 90class Keyboard : public QFrame
89{ 91{
90 Q_OBJECT 92 Q_OBJECT
91public: 93public:
92 Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); 94 Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 );
93 95
94 void resetState(); 96 void resetState();
95 97
96 void mousePressEvent(QMouseEvent*); 98 void mousePressEvent(QMouseEvent*);
97 void mouseReleaseEvent(QMouseEvent*); 99 void mouseReleaseEvent(QMouseEvent*);
98 void resizeEvent(QResizeEvent*); 100 void resizeEvent(QResizeEvent*);
99 void paintEvent(QPaintEvent* e); 101 void paintEvent(QPaintEvent* e);
100 //void timerEvent(QTimerEvent* e); 102 //void timerEvent(QTimerEvent* e);
101 void drawKeyboard( QPainter &p, int row = -1, int col = -1); 103 void drawKeyboard( QPainter &p, int row = -1, int col = -1);
102 104
103 QSize sizeHint() const; 105 QSize sizeHint() const;
104 106
105signals: 107signals:
106 void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); 108 void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool );
107 109
108private slots: 110private slots:
109 void repeat(); 111 void repeat();
110 void togglePickboard(bool on_off); 112 void togglePickboard(bool on_off);
113 void setMapToDefault();
114 void setMapToFile(QString file);
111 115
112private: 116private:
113 int getKey( int &w, int j = -1 ); 117 int getKey( int &w, int j = -1 );
114 void clearHighlight(); 118 void clearHighlight();
115 119
116 bool *shift; 120 bool *shift;
117 bool *lock; 121 bool *lock;
118 bool *ctrl; 122 bool *ctrl;
119 bool *alt; 123 bool *alt;
120 uint useLargeKeys:1; 124 uint useLargeKeys:1;
121 uint usePicks:1; 125 uint usePicks:1;
122 126
123 int pressedKeyRow; 127 int pressedKeyRow;
124 int pressedKeyCol; 128 int pressedKeyCol;
125 129
126 KeyboardPicks *picks; 130 KeyboardPicks *picks;
127 131
128 int keyHeight; 132 int keyHeight;
129 int defaultKeyWidth; 133 int defaultKeyWidth;
130 int xoffs; 134 int xoffs;
131 135
132 int unicode; 136 int unicode;
133 int qkeycode; 137 int qkeycode;
134 int modifiers; 138 int modifiers;
135 139
136 int pressTid; 140 int pressTid;
137 bool pressed; 141 bool pressed;
138 142
139 Keys keys; 143 Keys *keys;
140 QString LANG; 144
141 /* for korean input */ 145 /* for korean input */
142 ushort schar, mchar, echar; 146 ushort schar, mchar, echar;
143 ushort parseKoreanInput(ushort c); 147 ushort parseKoreanInput(ushort c);
144 ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); 148 ushort combineKoreanChars(const ushort s, const ushort m, const ushort e);
145 ushort constoe(const ushort c); 149 ushort constoe(const ushort c);
146 150
147 QTimer *repeatTimer; 151 QTimer *repeatTimer;
148 152
149 ConfigDlg *configdlg; 153 ConfigDlg *configdlg;
150}; 154};
151 155
152 156