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) (show whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp26
-rw-r--r--inputmethods/multikey/configdlg.h5
-rw-r--r--inputmethods/multikey/keyboard.cpp156
-rw-r--r--inputmethods/multikey/keyboard.h8
4 files changed, 151 insertions, 44 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
@@ -37,16 +37,24 @@ ConfigDlg::ConfigDlg () : QTabWidget ()
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
@@ -95,6 +103,18 @@ void ConfigDlg::pickTog() {
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,9 +1,10 @@
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{
@@ -11,16 +12,20 @@ class ConfigDlg : public QTabWidget
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
@@ -30,34 +30,37 @@
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();
@@ -65,15 +68,13 @@ Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
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
@@ -155,31 +156,31 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
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 );
@@ -199,31 +200,31 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
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) );
@@ -250,20 +251,20 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
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
@@ -275,36 +276,40 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
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 }
@@ -314,31 +319,31 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
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
@@ -486,12 +491,52 @@ void Keyboard::togglePickboard(bool on_off)
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
@@ -792,19 +837,30 @@ ushort Keyboard::constoe(const ushort c) {
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;
801 847
802 QString key_map = QPEApplication::qpeDir() + "/share/multikey/" 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/"
803 + l + ".keymap"; 856 + l + ".keymap";
804 857
858 }
859
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);
@@ -827,12 +883,13 @@ void Keys::setKeysFromFile(const char * filename) {
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;
@@ -872,22 +929,43 @@ void Keys::setKeysFromFile(const char * filename) {
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
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
@@ -64,12 +64,14 @@ public:
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;
@@ -105,12 +107,14 @@ public:
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;
@@ -133,14 +137,14 @@ private:
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