summaryrefslogtreecommitdiff
authorhash <hash>2002-08-18 06:18:18 (UTC)
committer hash <hash>2002-08-18 06:18:18 (UTC)
commit229a66f5a955ec71bd5973ac6961cd694692856a (patch) (unidiff)
treee2fa7e43d90728b972933e3fca77a897aa376287
parent5f271187a72b18339310f12a2c753e9b8548c078 (diff)
downloadopie-229a66f5a955ec71bd5973ac6961cd694692856a.zip
opie-229a66f5a955ec71bd5973ac6961cd694692856a.tar.gz
opie-229a66f5a955ec71bd5973ac6961cd694692856a.tar.bz2
paths to maps are now saved in config dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp29
-rw-r--r--inputmethods/multikey/configdlg.h2
-rw-r--r--inputmethods/multikey/keyboard.cpp33
-rw-r--r--inputmethods/multikey/keyboard.h2
4 files changed, 53 insertions, 13 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 7bea589..c4f7413 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,143 +1,166 @@
1/* 1/*
2 * TODO 2 * TODO
3 * make a font selection thing (size too) 3 * make a font selection thing (size too)
4 * 4 *
5 * 5 *
6 * 6 *
7 */ 7 */
8 8
9#include <qpe/qpeapplication.h> 9#include <qpe/qpeapplication.h>
10#include <qpe/config.h> 10#include <qpe/config.h>
11 11
12#include <qwidget.h> 12#include <qwidget.h>
13#include <qdialog.h> 13#include <qdialog.h>
14#include <qtabwidget.h> 14#include <qtabwidget.h>
15#include <qvbox.h> 15#include <qvbox.h>
16#include <qgrid.h> 16#include <qgrid.h>
17#include <qgroupbox.h> 17#include <qgroupbox.h>
18#include <qlabel.h> 18#include <qlabel.h>
19#include <qcheckbox.h> 19#include <qcheckbox.h>
20#include <qsizepolicy.h> 20#include <qsizepolicy.h>
21#include <qpushbutton.h> 21#include <qpushbutton.h>
22#include <qlistbox.h> 22#include <qlistbox.h>
23#include <qstringlist.h>
23#include "configdlg.h" 24#include "configdlg.h"
24#include "keyboard.h" 25#include "keyboard.h"
25 26
26ConfigDlg::ConfigDlg () : QTabWidget () 27ConfigDlg::ConfigDlg () : QTabWidget ()
27{ 28{
28 setCaption( tr("Multikey Configuration") ); 29 setCaption( tr("Multikey Configuration") );
30 Config config ("multikey");
29 31
30 /* 32 /*
31 * 'general config' tab 33 * 'general config' tab
32 */ 34 */
33 35
34 QVBox *gen_box = new QVBox (this); 36 QVBox *gen_box = new QVBox (this);
35 gen_box->setMargin(3); 37 gen_box->setMargin(3);
36 addTab(gen_box, tr("General Settings")); 38 addTab(gen_box, tr("General Settings"));
37 39
38 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); 40 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box);
39 41
40 keymaps = new QListBox (map_group); 42 keymaps = new QListBox (map_group);
41 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 43 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
42 //keymaps->setMaximumHeight(150);
43 44
44 QString cur(tr("Current Language")); 45 QString cur(tr("Current Language"));
45 keymaps->insertItem(cur); 46 keymaps->insertItem(cur);
47
48 config.setGroup ("keymaps");
49 QStringList maps = config.readListEntry("maps", QChar('|'));
50
51 for (unsigned int i = 0; i < maps.count(); i++) {
52
53 keymaps->insertItem(maps[i]);
54 }
55
56 // have to "+1" because the "current language" listItem... remember?
57 keymaps->setSelected(config.readNumEntry("current", 0) + 1, true);
58
46 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); 59 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int)));
47 60
61 /*
48 QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap"); 62 QString ko(QPEApplication::qpeDir() + "/share/multikey/ko.keymap");
49 keymaps->insertItem(ko); 63 keymaps->insertItem(ko);
50 64
51 QString en(QPEApplication::qpeDir() + "/share/multikey/en.keymap"); 65 QString en(QPEApplication::qpeDir() + "/share/multikey/en.keymap");
52 keymaps->insertItem(en); 66 keymaps->insertItem(en);
53 67
54 QString de(QPEApplication::qpeDir() + "/share/multikey/de.keymap"); 68 QString de(QPEApplication::qpeDir() + "/share/multikey/de.keymap");
55 keymaps->insertItem(de); 69 keymaps->insertItem(de);
70 */
56 71
57 QGrid *add_remove_grid = new QGrid(2, map_group); 72 QGrid *add_remove_grid = new QGrid(2, map_group);
58 add_remove_grid->setMargin(3); 73 add_remove_grid->setMargin(3);
59 add_remove_grid->setSpacing(3); 74 add_remove_grid->setSpacing(3);
60 75
61 add_button = new QPushButton(tr("Add"), add_remove_grid); 76 add_button = new QPushButton(tr("Add"), add_remove_grid);
62 add_button->setFlat((bool)1); 77 add_button->setFlat((bool)1);
63 78
64 remove_button = new QPushButton(tr("Remove"), add_remove_grid); 79 remove_button = new QPushButton(tr("Remove"), add_remove_grid);
65 remove_button->setFlat((bool)1); 80 remove_button->setFlat((bool)1);
66 81
67 pick_button = new QCheckBox(tr("Pickboard"), gen_box); 82 pick_button = new QCheckBox(tr("Pickboard"), gen_box);
68 83
69 Config config ("multikey");
70 config.setGroup ("pickboard"); 84 config.setGroup ("pickboard");
71 bool pick_open = config.readBoolEntry ("open", "0"); // default closed 85 bool pick_open = config.readBoolEntry ("open", "0"); // default closed
72 if (pick_open) { 86 if (pick_open) {
73 87
74 pick_button->setChecked(true); 88 pick_button->setChecked(true);
75 } 89 }
76 90
77 // by connecting it after checking it, the signal isn't emmited 91 // by connecting it after checking it, the signal isn't emmited
78 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); 92 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
79 93
80 /* 94 /*
81 * 'color' tab 95 * 'color' tab
82 */ 96 */
83 97
84 QGrid *color_box = new QGrid(2, this); 98 QGrid *color_box = new QGrid(2, this);
85 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 99 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
86 color_box->setMargin(3); 100 color_box->setMargin(3);
87 color_box->setSpacing(3); 101 color_box->setSpacing(3);
88 addTab(color_box, tr("Colors")); 102 addTab(color_box, tr("Colors"));
89 103
90 QLabel *label; 104 QLabel *label;
91 105
92 label = new QLabel(tr("Key Color"), color_box); 106 label = new QLabel(tr("Key Color"), color_box);
93 QPushButton *button = new QPushButton(color_box); 107 QPushButton *button = new QPushButton(color_box);
94 button->setFlat((bool)1); 108 button->setFlat((bool)1);
95 label = new QLabel(tr("Key Pressed Color"), color_box); 109 label = new QLabel(tr("Key Pressed Color"), color_box);
96 button = new QPushButton(color_box); 110 button = new QPushButton(color_box);
97 button->setFlat((bool)1); 111 button->setFlat((bool)1);
98 label = new QLabel(tr("Line Color"), color_box); 112 label = new QLabel(tr("Line Color"), color_box);
99 button = new QPushButton(color_box); 113 button = new QPushButton(color_box);
100 button->setFlat((bool)1); 114 button->setFlat((bool)1);
101 label = new QLabel(tr("Text Color"), color_box); 115 label = new QLabel(tr("Text Color"), color_box);
102 button = new QPushButton(color_box); 116 button = new QPushButton(color_box);
103 button->setFlat((bool)1); 117 button->setFlat((bool)1);
104 118
105 label = new QLabel("", color_box); // a spacer so the above buttons dont expand 119 label = new QLabel("", color_box); // a spacer so the above buttons dont expand
106 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 120 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
107 121
108} 122}
109 123
110void ConfigDlg::pickTog() { 124void ConfigDlg::pickTog() {
111 125
112 Config config ("multikey"); 126 Config config ("multikey");
113 config.setGroup ("pickboard"); 127 config.setGroup ("pickboard");
114 config.writeEntry ("open", pick_button->isChecked()); // default closed 128 config.writeEntry ("open", pick_button->isChecked()); // default closed
115 129
116 emit pickboardToggled(pick_button->isChecked()); 130 emit pickboardToggled(pick_button->isChecked());
117} 131}
118 132
133/*
134 * the index is kinda screwy, because in the config file, index 0 is just the
135 * first element in the QStringList, but here it's the "Current Language"
136 * listItem. therefor you have to minus one to the index before you access
137 * it from the config file.
138 *
139 * and later on, the "current language" setting should be -1 in the config file
140 */
141
119void ConfigDlg::setMap(int index) { 142void ConfigDlg::setMap(int index) {
120 143
121 if (index == 0) { 144 if (index == 0) {
122 145
123 if (remove_button->isEnabled()) 146 if (remove_button->isEnabled())
124 remove_button->setDisabled(true); 147 remove_button->setDisabled(true);
125 148
126 emit setMapToDefault(); 149 emit setMapToDefault();
127 } 150 }
128 else { 151 else {
129 152
130 if (!remove_button->isEnabled()) 153 if (!remove_button->isEnabled())
131 remove_button->setEnabled(true); 154 remove_button->setEnabled(true);
132 155
133 emit setMapToFile(keymaps->text(index)); 156 emit setMapToFile(index - 1);
134 } 157 }
135} 158}
136 159
137void ConfigDlg::addMap() { 160void ConfigDlg::addMap() {
138 161
139} 162}
140 163
141void ConfigDlg::removeMap(int index) { 164void ConfigDlg::removeMap(int index) {
142 165
143} 166}
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index 1a64764..03a3547 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -1,36 +1,36 @@
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 <qlistbox.h> 4#include <qlistbox.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6 6
7#ifndef CONFIGDLG_H 7#ifndef CONFIGDLG_H
8#define CONFIGDLG_H 8#define CONFIGDLG_H
9 9
10class ConfigDlg : public QTabWidget 10class ConfigDlg : public QTabWidget
11{ 11{
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
15 ConfigDlg (); 15 ConfigDlg ();
16 16
17signals: 17signals:
18 void pickboardToggled(bool on_off); 18 void pickboardToggled(bool on_off);
19 void setMapToDefault(); 19 void setMapToDefault();
20 void setMapToFile(QString file); 20 void setMapToFile(int index);
21 21
22private slots: 22private slots:
23 void pickTog(); 23 void pickTog();
24 void setMap(int index); 24 void setMap(int index);
25 void addMap(); 25 void addMap();
26 void removeMap(int index); 26 void removeMap(int index);
27 27
28private: 28private:
29 QCheckBox *pick_button; 29 QCheckBox *pick_button;
30 QListBox *keymaps; 30 QListBox *keymaps;
31 QPushButton *add_button; 31 QPushButton *add_button;
32 QPushButton *remove_button; 32 QPushButton *remove_button;
33 33
34}; 34};
35 35
36#endif 36#endif
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 671868c..c53ae6c 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -1,99 +1,101 @@
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 <qstringlist.h>
37#include <iostream.h>
36 38
37#include <sys/utsname.h> 39#include <sys/utsname.h>
38 40
39 41
40#define USE_SMALL_BACKSPACE 42#define USE_SMALL_BACKSPACE
41 43
42/* Keyboard::Keyboard {{{1 */ 44/* Keyboard::Keyboard {{{1 */
43Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 45Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
44 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), 46 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0),
45 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1), 47 alt(0), useLargeKeys(TRUE), usePicks(0), pressedKeyRow(-1), pressedKeyCol(-1),
46 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), 48 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
47 configdlg(0) 49 configdlg(0)
48 50
49{ 51{
50 // get the default font 52 // get the default font
51 Config *config = new Config( "qpe" ); 53 Config *config = new Config( "qpe" );
52 config->setGroup( "Appearance" ); 54 config->setGroup( "Appearance" );
53 QString familyStr = config->readEntry( "FontFamily", "fixed" ); 55 QString familyStr = config->readEntry( "FontFamily", "fixed" );
54 delete config; 56 delete config;
55 57
56 config = new Config("multikey"); 58 config = new Config("multikey");
57 config->setGroup ("pickboard"); 59 config->setGroup ("pickboard");
58 usePicks = config->readBoolEntry ("open", "0"); // default closed 60 usePicks = config->readBoolEntry ("open", "0"); // default closed
59 delete config; 61 delete config;
60 62
61 setFont( QFont( familyStr, 10 ) ); 63 setFont( QFont( familyStr, 10 ) );
62 64
63 picks = new KeyboardPicks( this ); 65 picks = new KeyboardPicks( this );
64 picks->setFont( QFont( familyStr, 10 ) ); 66 picks->setFont( QFont( familyStr, 10 ) );
65 picks->initialise(); 67 picks->initialise();
66 if (usePicks) { 68 if (usePicks) {
67 69
68 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 70 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
69 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 71 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
70 72
71 } else picks->hide(); 73 } else picks->hide();
72 74
73 keys = new Keys(); 75 keys = new Keys();
74 76
75 repeatTimer = new QTimer( this ); 77 repeatTimer = new QTimer( this );
76 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 78 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
77 79
78} 80}
79Keyboard::~Keyboard() { 81Keyboard::~Keyboard() {
80 82
81 if ( configdlg ) { 83 if ( configdlg ) {
82 delete (ConfigDlg *) configdlg; 84 delete (ConfigDlg *) configdlg;
83 configdlg = 0; 85 configdlg = 0;
84 } 86 }
85 87
86} 88}
87 89
88/* Keyboard::resizeEvent {{{1 */ 90/* Keyboard::resizeEvent {{{1 */
89void Keyboard::resizeEvent(QResizeEvent*) 91void Keyboard::resizeEvent(QResizeEvent*)
90{ 92{
91 int ph = picks->sizeHint().height(); 93 int ph = picks->sizeHint().height();
92 picks->setGeometry( 0, 0, width(), ph ); 94 picks->setGeometry( 0, 0, width(), ph );
93 keyHeight = (height()-(usePicks ? ph : 0))/5; 95 keyHeight = (height()-(usePicks ? ph : 0))/5;
94 96
95 int nk; // number of keys? 97 int nk; // number of keys?
96 if ( useLargeKeys ) { 98 if ( useLargeKeys ) {
97 nk = 15; 99 nk = 15;
98 } else { 100 } else {
99 nk = 19; 101 nk = 19;
@@ -227,130 +229,130 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
227 if (!pix) { 229 if (!pix) {
228 p.setPen(textcolor); 230 p.setPen(textcolor);
229 p.drawText(x, y, 231 p.drawText(x, y,
230 keyWidthPix, keyHeight, 232 keyWidthPix, keyHeight,
231 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); 233 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c);
232 } 234 }
233 else { 235 else {
234 // center the image in the middle of the key 236 // center the image in the middle of the key
235 p.drawPixmap( x + (keyWidthPix - pix->width())/2, 237 p.drawPixmap( x + (keyWidthPix - pix->width())/2,
236 y + (keyHeight - pix->height())/2 + 1, 238 y + (keyHeight - pix->height())/2 + 1,
237 QPixmap(*pix) ); 239 QPixmap(*pix) );
238 } 240 }
239 241
240 p.setPen(keycolor_lines); 242 p.setPen(keycolor_lines);
241 p.drawLine(x, y, x, y + keyHeight); 243 p.drawLine(x, y, x, y + keyHeight);
242 244
243 x += keyWidthPix; 245 x += keyWidthPix;
244 } 246 }
245 247
246 248
247 } 249 }
248 p.drawLine(0, height() - 1, width(), height() - 1); 250 p.drawLine(0, height() - 1, width(), height() - 1);
249 p.drawLine(width() - 1, 0, width() - 1, height()); 251 p.drawLine(width() - 1, 0, width() - 1, height());
250 } 252 }
251 253
252} 254}
253 255
254 256
255/* Keyboard::mousePressEvent {{{1 */ 257/* Keyboard::mousePressEvent {{{1 */
256void Keyboard::mousePressEvent(QMouseEvent *e) 258void Keyboard::mousePressEvent(QMouseEvent *e)
257{ 259{
258 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; 260 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
259 if (row > 5) row = 5; 261 if (row > 5) row = 5;
260 262
261 // figure out the column 263 // figure out the column
262 int col = 0; 264 int col = 0;
263 for (int w = 0; e->x() >= w; col++) 265 for (int w = 0; e->x() >= w; col++)
264 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys 266 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
265 w += keys->width(row,col) * defaultKeyWidth; 267 w += keys->width(row,col) * defaultKeyWidth;
266 else break; 268 else break;
267 269
268 col --; // rewind one... 270 col --; // rewind one...
269 271
270 qkeycode = keys->qcode(row, col); 272 qkeycode = keys->qcode(row, col);
271 unicode = keys->uni(row, col); 273 unicode = keys->uni(row, col);
272 274
273 // might need to repaint if two or more of the same keys. 275 // might need to repaint if two or more of the same keys.
274 // should be faster if just paint one key even though multiple keys exist. 276 // should be faster if just paint one key even though multiple keys exist.
275 bool need_repaint = FALSE; 277 bool need_repaint = FALSE;
276 278
277 if (unicode == 0) { // either Qt char, or nothing 279 if (unicode == 0) { // either Qt char, or nothing
278 280
279 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 281 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
280 282
281 if ( configdlg ) { 283 if ( configdlg ) {
282 delete (ConfigDlg *) configdlg; 284 delete (ConfigDlg *) configdlg;
283 configdlg = 0; 285 configdlg = 0;
284 } 286 }
285 else { 287 else {
286 configdlg = new ConfigDlg (); 288 configdlg = new ConfigDlg ();
287 connect(configdlg, SIGNAL(pickboardToggled(bool)), 289 connect(configdlg, SIGNAL(pickboardToggled(bool)),
288 this, SLOT(togglePickboard(bool))); 290 this, SLOT(togglePickboard(bool)));
289 connect(configdlg, SIGNAL(setMapToDefault()), 291 connect(configdlg, SIGNAL(setMapToDefault()),
290 this, SLOT(setMapToDefault())); 292 this, SLOT(setMapToDefault()));
291 connect(configdlg, SIGNAL(setMapToFile(QString)), 293 connect(configdlg, SIGNAL(setMapToFile(int)),
292 this, SLOT(setMapToFile(QString))); 294 this, SLOT(setMapToFile(int)));
293 configdlg->showMaximized(); 295 configdlg->showMaximized();
294 configdlg->show(); 296 configdlg->show();
295 configdlg->raise(); 297 configdlg->raise();
296 } 298 }
297 299
298 } else if (qkeycode == Qt::Key_Control) { 300 } else if (qkeycode == Qt::Key_Control) {
299 ctrl = keys->pressedPtr(row, col); 301 ctrl = keys->pressedPtr(row, col);
300 need_repaint = TRUE; 302 need_repaint = TRUE;
301 *ctrl = !keys->pressed(row, col); 303 *ctrl = !keys->pressed(row, col);
302 304
303 } else if (qkeycode == Qt::Key_Alt) { 305 } else if (qkeycode == Qt::Key_Alt) {
304 alt = keys->pressedPtr(row, col); 306 alt = keys->pressedPtr(row, col);
305 need_repaint = TRUE; 307 need_repaint = TRUE;
306 *alt = !keys->pressed(row, col); 308 *alt = !keys->pressed(row, col);
307 309
308 } else if (qkeycode == Qt::Key_Shift) { 310 } else if (qkeycode == Qt::Key_Shift) {
309 need_repaint = TRUE; 311 need_repaint = TRUE;
310 312
311 if (shift) { 313 if (shift) {
312 *shift = 0; 314 *shift = 0;
313 shift = 0; 315 shift = 0;
314 } 316 }
315 else { 317 else {
316 shift = keys->pressedPtr(row, col); 318 shift = keys->pressedPtr(row, col);
317 *shift = 1; 319 *shift = 1;
318 if (lock) { 320 if (lock) {
319 *lock = 0; 321 *lock = 0;
320 lock = 0; 322 lock = 0;
321 } 323 }
322 } 324 }
323 325
324 } else if (qkeycode == Qt::Key_CapsLock) { 326 } else if (qkeycode == Qt::Key_CapsLock) {
325 need_repaint = TRUE; 327 need_repaint = TRUE;
326 328
327 if (lock) { 329 if (lock) {
328 *lock = 0; 330 *lock = 0;
329 lock = 0; 331 lock = 0;
330 } 332 }
331 else { 333 else {
332 lock = keys->pressedPtr(row, col);; 334 lock = keys->pressedPtr(row, col);;
333 *lock = 1; 335 *lock = 1;
334 if (shift) { 336 if (shift) {
335 *shift = 0; 337 *shift = 0;
336 shift = 0; 338 shift = 0;
337 } 339 }
338 } 340 }
339 341
340 } 342 }
341 343
342 } 344 }
343 else { // normal char 345 else { // normal char
344 if ((shift || lock) && keys->shift(unicode)) { 346 if ((shift || lock) && keys->shift(unicode)) {
345 unicode = keys->shift(unicode); 347 unicode = keys->shift(unicode);
346 } 348 }
347 } 349 }
348 350
349 // korean parsing 351 // korean parsing
350 if (keys->lang == "ko") { 352 if (keys->lang == "ko") {
351 353
352 unicode = parseKoreanInput(unicode); 354 unicode = parseKoreanInput(unicode);
353 } 355 }
354 356
355 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); 357 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0);
356 358
@@ -456,148 +458,156 @@ void Keyboard::clearHighlight()
456 drawKeyboard(p, tmpRow, tmpCol); 458 drawKeyboard(p, tmpRow, tmpCol);
457 } 459 }
458} 460}
459 461
460 462
461/* Keyboard::sizeHint {{{1 */ 463/* Keyboard::sizeHint {{{1 */
462QSize Keyboard::sizeHint() const 464QSize Keyboard::sizeHint() const
463{ 465{
464 QFontMetrics fm=fontMetrics(); 466 QFontMetrics fm=fontMetrics();
465 int keyHeight = fm.lineSpacing() + 2; 467 int keyHeight = fm.lineSpacing() + 2;
466 468
467 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); 469 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1);
468} 470}
469 471
470 472
471void Keyboard::resetState() 473void Keyboard::resetState()
472{ 474{
473 schar = mchar = echar = 0; 475 schar = mchar = echar = 0;
474 picks->resetState(); 476 picks->resetState();
475} 477}
476 478
477/* Keyboard::togglePickboard {{{1 */ 479/* Keyboard::togglePickboard {{{1 */
478void Keyboard::togglePickboard(bool on_off) 480void Keyboard::togglePickboard(bool on_off)
479{ 481{
480 usePicks = on_off; 482 usePicks = on_off;
481 if (usePicks) { 483 if (usePicks) {
482 picks->show(); 484 picks->show();
483 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send 485 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send
484 //adjustSize(); 486 //adjustSize();
485 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 487 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
486 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 488 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
487 } else { 489 } else {
488 490
489 picks->hide(); 491 picks->hide();
490 picks->resetState(); 492 picks->resetState();
491 //move(x(), y() + picks->height()); 493 //move(x(), y() + picks->height());
492 //adjustSize(); 494 //adjustSize();
493 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 495 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
494 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 496 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
495 497
496 } 498 }
497 /* 499 /*
498 * this closes && opens the input method 500 * this closes && opens the input method
499 */ 501 */
500 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); 502 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
501 QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); 503 QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
502} 504}
503 505
504/* Keyboard::setMapTo ... {{{1 */ 506/* Keyboard::setMapTo ... {{{1 */
505void Keyboard::setMapToDefault() { 507void Keyboard::setMapToDefault() {
506 508
507 509
508 /* load current locale language map */ 510 /* load current locale language map */
509 Config *config = new Config("locale"); 511 Config *config = new Config("locale");
510 config->setGroup( "Language" ); 512 config->setGroup( "Language" );
511 QString l = config->readEntry( "Language" , "en" ); 513 QString l = config->readEntry( "Language" , "en" );
512 delete config; 514 delete config;
513 515
514 QString key_map = QPEApplication::qpeDir() + "/share/multikey/" 516 QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
515 + l + ".keymap"; 517 + l + ".keymap";
516 518
517 /* save change to multikey config file */ 519 /* save change to multikey config file */
518 config = new Config("multikey"); 520 config = new Config("multikey");
519 config->setGroup ("keymaps"); 521 config->setGroup ("keymaps");
520 config->writeEntry ("current", key_map); // default closed 522 config->writeEntry ("current", -1); // default closed
521 delete config; 523 delete config;
522 524
523 delete keys; 525 delete keys;
524 keys = new Keys(key_map); 526 keys = new Keys(key_map);
525 527
526 // have to repaint the keyboard 528 // have to repaint the keyboard
527 repaint(FALSE); 529 repaint(FALSE);
528} 530}
529 531
530void Keyboard::setMapToFile(QString file) { 532void Keyboard::setMapToFile(int index) {
531 533
532 /* save change to multikey config file */ 534 /* save change to multikey config file */
533 Config *config = new Config("multikey"); 535 Config *config = new Config("multikey");
534 config->setGroup ("keymaps"); 536 config->setGroup ("keymaps");
535 config->writeEntry ("current", file); // default closed 537 config->writeEntry ("current", index); // default closed
538
539
540 /* now you have to retrieve the map */
541 QStringList maps = config->readListEntry("maps", QChar('|'));
536 delete config; 542 delete config;
537 543
538 delete keys; 544 delete keys;
539 keys = new Keys(file); 545 if (index < 0 || (int)maps.count() <= index)
546 keys = new Keys();
547 else
548 keys = new Keys(maps[index]);
549
540 repaint(FALSE); 550 repaint(FALSE);
541 551
542} 552}
543 553
544/* korean input functions {{{1 554/* korean input functions {{{1
545 * 555 *
546 * TODO 556 * TODO
547 * one major problem with this implementation is that you can't move the 557 * one major problem with this implementation is that you can't move the
548 * cursor after inputing korean chars, otherwise it will eat up and replace 558 * cursor after inputing korean chars, otherwise it will eat up and replace
549 * the char before the cursor you move to. fix that 559 * the char before the cursor you move to. fix that
550 * 560 *
551 * make backspace delete one single char, not the whole thing if still 561 * make backspace delete one single char, not the whole thing if still
552 * editing. 562 * editing.
553 * 563 *
554 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 564 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
555 * 565 *
556 * how korean input works 566 * how korean input works
557 * 567 *
558 * all following chars means unicode char value and are in hex 568 * all following chars means unicode char value and are in hex
559 * 569 *
560 * ÃÊÀ½ = schar (start char) 570 * ÃÊÀ½ = schar (start char)
561 * ÁßÀ½ = mchar (middle char) 571 * ÁßÀ½ = mchar (middle char)
562 * ³¡À½ = echar (end char) 572 * ³¡À½ = echar (end char)
563 * 573 *
564 * there are 19 schars. unicode position is at 1100 - 1112 574 * there are 19 schars. unicode position is at 1100 - 1112
565 * there are 21 mchars. unicode position is at 1161 - 1175 575 * there are 21 mchars. unicode position is at 1161 - 1175
566 * there are 27 echars. unicode position is at 11a8 - 11c2 576 * there are 27 echars. unicode position is at 11a8 - 11c2
567 * 577 *
568 * the map with everything combined is at ac00 - d7a3 578 * the map with everything combined is at ac00 - d7a3
569 * 579 *
570 */ 580 */
571 581
572ushort Keyboard::parseKoreanInput (ushort c) { 582ushort Keyboard::parseKoreanInput (ushort c) {
573 583
574 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) 584 if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c))
575 || 585 ||
576 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode 586 (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode
577 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { 587 && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) {
578 588
579 schar = 0, mchar = 0, echar = 0; 589 schar = 0, mchar = 0, echar = 0;
580 return c; 590 return c;
581 } 591 }
582 592
583 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input 593 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input
584 594
585 if (schar == 0 || (schar != 0 && mchar == 0)) { 595 if (schar == 0 || (schar != 0 && mchar == 0)) {
586 schar = c; mchar = 0; echar = 0; 596 schar = c; mchar = 0; echar = 0;
587 return c; 597 return c;
588 } 598 }
589 else if (mchar != 0) { 599 else if (mchar != 0) {
590 600
591 if (echar == 0) { 601 if (echar == 0) {
592 602
593 if (!(echar = constoe(c))) { 603 if (!(echar = constoe(c))) {
594 604
595 schar = c; mchar = 0; echar = 0; 605 schar = c; mchar = 0; echar = 0;
596 return c; 606 return c;
597 } 607 }
598 608
599 } 609 }
600 else { // must figure out what the echar is 610 else { // must figure out what the echar is
601 611
602 if (echar == 0x11a8) { // ¤¡ 612 if (echar == 0x11a8) { // ¤¡
603 613
@@ -788,141 +798,148 @@ ushort Keyboard::combineKoreanChars(const ushort s, const ushort m, const ushort
788 return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00; 798 return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00;
789 799
790} 800}
791 801
792ushort Keyboard::constoe(const ushort c) { 802ushort Keyboard::constoe(const ushort c) {
793 803
794 // converts schars to echars if possible 804 // converts schars to echars if possible
795 805
796 if (0x1100 <= c && c <= 0x1112) { // schar to echar 806 if (0x1100 <= c && c <= 0x1112) { // schar to echar
797 807
798 switch (c) { 808 switch (c) {
799 case 0x1100: return 0x11a8; 809 case 0x1100: return 0x11a8;
800 case 0x1101: return 0x11a9; 810 case 0x1101: return 0x11a9;
801 case 0x1102: return 0x11ab; 811 case 0x1102: return 0x11ab;
802 case 0x1103: return 0x11ae; 812 case 0x1103: return 0x11ae;
803 case 0x1105: return 0x11af; 813 case 0x1105: return 0x11af;
804 case 0x1106: return 0x11b7; 814 case 0x1106: return 0x11b7;
805 case 0x1107: return 0x11b8; 815 case 0x1107: return 0x11b8;
806 case 0x1109: return 0x11ba; 816 case 0x1109: return 0x11ba;
807 case 0x110a: return 0x11bb; 817 case 0x110a: return 0x11bb;
808 case 0x110b: return 0x11bc; 818 case 0x110b: return 0x11bc;
809 case 0x110c: return 0x11bd; 819 case 0x110c: return 0x11bd;
810 case 0x110e: return 0x11be; 820 case 0x110e: return 0x11be;
811 case 0x110f: return 0x11bf; 821 case 0x110f: return 0x11bf;
812 case 0x1110: return 0x11c0; 822 case 0x1110: return 0x11c0;
813 case 0x1111: return 0x11c1; 823 case 0x1111: return 0x11c1;
814 case 0x1112: return 0x11c2; 824 case 0x1112: return 0x11c2;
815 default: return 0; 825 default: return 0;
816 826
817 } 827 }
818 828
819 } else { //echar to schar 829 } else { //echar to schar
820 830
821 switch (c) { 831 switch (c) {
822 case 0x11a8: return 0x1100; 832 case 0x11a8: return 0x1100;
823 case 0x11a9: return 0x1101; 833 case 0x11a9: return 0x1101;
824 case 0x11ab: return 0x1102; 834 case 0x11ab: return 0x1102;
825 case 0x11ae: return 0x1103; 835 case 0x11ae: return 0x1103;
826 case 0x11af: return 0x1105; 836 case 0x11af: return 0x1105;
827 case 0x11b7: return 0x1106; 837 case 0x11b7: return 0x1106;
828 case 0x11b8: return 0x1107; 838 case 0x11b8: return 0x1107;
829 case 0x11ba: return 0x1109; 839 case 0x11ba: return 0x1109;
830 case 0x11bb: return 0x110a; 840 case 0x11bb: return 0x110a;
831 case 0x11bc: return 0x110b; 841 case 0x11bc: return 0x110b;
832 case 0x11bd: return 0x110c; 842 case 0x11bd: return 0x110c;
833 case 0x11be: return 0x110e; 843 case 0x11be: return 0x110e;
834 case 0x11bf: return 0x110f; 844 case 0x11bf: return 0x110f;
835 case 0x11c0: return 0x1110; 845 case 0x11c0: return 0x1110;
836 case 0x11c1: return 0x1111; 846 case 0x11c1: return 0x1111;
837 case 0x11c2: return 0x1112; 847 case 0x11c2: return 0x1112;
838 default: return 0; 848 default: return 0;
839 849
840 } 850 }
841 851
842 } 852 }
843} 853}
844 854
845 855
846// Keys::Keys {{{1 856// Keys::Keys {{{1
847 857
848Keys::Keys() { 858Keys::Keys() {
849 859
850 Config *config = new Config ("multikey"); 860 Config *config = new Config ("multikey");
851 config->setGroup( "keymaps" ); 861 config->setGroup( "keymaps" );
852 QString key_map = config->readEntry( "current" ); 862 QStringList maps = config->readListEntry ("maps", QChar('|'));
863
864 int index = config->readNumEntry( "current", -1 );
853 delete config; 865 delete config;
854 866
855 if (key_map.isNull()) { 867 QString key_map;
868
869 if (index < 0 || (int)maps.count() <= index) {
856 870
857 Config *config = new Config("locale"); 871 Config *config = new Config("locale");
858 config->setGroup( "Language" ); 872 config->setGroup( "Language" );
859 QString l = config->readEntry( "Language" , "en" ); 873 QString l = config->readEntry( "Language" , "en" );
860 delete config; 874 delete config;
861 875
862 key_map = QPEApplication::qpeDir() + "/share/multikey/" 876 key_map = QPEApplication::qpeDir() + "/share/multikey/"
863 + l + ".keymap"; 877 + l + ".keymap";
864 878
879 } else {
880
881 key_map = maps[index];
865 } 882 }
866 883
867 884
868 setKeysFromFile(key_map); 885 setKeysFromFile(key_map);
869} 886}
870 887
871Keys::Keys(const char * filename) { 888Keys::Keys(const char * filename) {
872 889
873 setKeysFromFile(filename); 890 setKeysFromFile(filename);
874} 891}
875 892
876// Keys::setKeysFromFile {{{2 893// Keys::setKeysFromFile {{{2
877void Keys::setKeysFromFile(const char * filename) { 894void Keys::setKeysFromFile(const char * filename) {
878 895
879 QFile f(filename); 896 QFile f(filename);
880 897
881 if (f.open(IO_ReadOnly)) { 898 if (f.open(IO_ReadOnly)) {
882 899
883 QTextStream t(&f); 900 QTextStream t(&f);
884 int row; 901 int row;
885 int qcode; 902 int qcode;
886 ushort unicode; 903 ushort unicode;
887 int width; 904 int width;
888 QString buf; 905 QString buf;
889 QString comment; 906 QString comment;
890 char * xpm[256]; //couldnt be larger than that... could it? 907 char * xpm[256]; //couldnt be larger than that... could it?
891 QPixmap *xpm2pix = 0; 908 QPixmap *xpm2pix = 0;
892 909
893 buf = t.readLine(); 910 buf = t.readLine();
894 while (buf) { 911 while (buf) {
895 912
896 // key definition 913 // key definition
897 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) { 914 if (buf.contains(QRegExp("^\\d+\\s+[0-1a-fx]+", FALSE, FALSE))) {
898 // no $1 type referencing!!! this implementation of regexp sucks 915 // no $1 type referencing!!! this implementation of regexp sucks
899 916
900 // dont know of any sscanf() type funcs in Qt lib 917 // dont know of any sscanf() type funcs in Qt lib
901 QTextStream tmp (buf, IO_ReadOnly); 918 QTextStream tmp (buf, IO_ReadOnly);
902 tmp >> row >> qcode >> unicode >> width >> comment; 919 tmp >> row >> qcode >> unicode >> width >> comment;
903 920
904 buf = t.readLine(); 921 buf = t.readLine();
905 int xpmLineCount = 0; 922 int xpmLineCount = 0;
906 xpm2pix = 0; 923 xpm2pix = 0;
907 924
908 // erase blank space 925 // erase blank space
909 while (buf.contains(QRegExp("^\\s*$")) && buf) buf = t.readLine(); 926 while (buf.contains(QRegExp("^\\s*$")) && buf) buf = t.readLine();
910 927
911 while (buf.contains(QRegExp("^\\s*\".*\""))) { 928 while (buf.contains(QRegExp("^\\s*\".*\""))) {
912 929
913 QString xpmBuf = buf.stripWhiteSpace(); 930 QString xpmBuf = buf.stripWhiteSpace();
914 931
915 xpm[xpmLineCount] = new char [xpmBuf.length()]; 932 xpm[xpmLineCount] = new char [xpmBuf.length()];
916 933
917 int j = 0; 934 int j = 0;
918 for (ushort i = 0; i < xpmBuf.length(); i++) { 935 for (ushort i = 0; i < xpmBuf.length(); i++) {
919 if (xpmBuf[i].latin1() != '"') { 936 if (xpmBuf[i].latin1() != '"') {
920 937
921 ((char *)xpm[xpmLineCount])[j] = xpmBuf.at(i).latin1(); 938 ((char *)xpm[xpmLineCount])[j] = xpmBuf.at(i).latin1();
922 j++; 939 j++;
923 } 940 }
924 941
925 } 942 }
926 // have to close that facker up 943 // have to close that facker up
927 ((char *)xpm[xpmLineCount])[j] = '\0'; 944 ((char *)xpm[xpmLineCount])[j] = '\0';
928 945
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index 400edc0..7a8d4b4 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -52,107 +52,107 @@ public:
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 ~Keys(); 58 ~Keys();
59 ushort uni(const int row, const int col); 59 ushort uni(const int row, const int col);
60 int qcode(const int row, const int col); 60 int qcode(const int row, const int col);
61 int width(const int row, const int col); 61 int width(const int row, const int col);
62 bool pressed(const int row, const int col); 62 bool pressed(const int row, const int col);
63 bool *pressedPtr(const int row, const int col); 63 bool *pressedPtr(const int row, const int col);
64 ushort shift(const ushort); 64 ushort shift(const ushort);
65 QPixmap *pix(const int row, const int col); 65 QPixmap *pix(const int row, const int col);
66 int numKeys(const int row); 66 int numKeys(const int row);
67 void setKeysFromFile(const char *filename); 67 void setKeysFromFile(const char *filename);
68 void setKey(const int row, const int qcode, const ushort unicode, 68 void setKey(const int row, const int qcode, const ushort unicode,
69 const int width, QPixmap *pix); 69 const int width, QPixmap *pix);
70 void setPressed(const int row, const int col, const bool pressed); 70 void setPressed(const int row, const int col, const bool pressed);
71 QString lang; 71 QString lang;
72 QString title; 72 QString title;
73 73
74private: 74private:
75 75
76 typedef struct Key { 76 typedef struct Key {
77 int qcode; // are qt key codes just unicode values? 77 int qcode; // are qt key codes just unicode values?
78 ushort unicode; 78 ushort unicode;
79 int width; // not pixels but relative key width. normal key is 2 79 int width; // not pixels but relative key width. normal key is 2
80 80
81 // only needed for keys like ctrl that can have multiple keys pressed at once 81 // only needed for keys like ctrl that can have multiple keys pressed at once
82 bool *pressed; 82 bool *pressed;
83 QPixmap *pix; 83 QPixmap *pix;
84 }; 84 };
85 85
86 QList<Key> keys[6]; 86 QList<Key> keys[6];
87 QMap<ushort,ushort> shiftMap; 87 QMap<ushort,ushort> shiftMap;
88 88
89}; 89};
90 90
91class Keyboard : public QFrame 91class Keyboard : public QFrame
92{ 92{
93 Q_OBJECT 93 Q_OBJECT
94public: 94public:
95 Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); 95 Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 );
96 ~Keyboard(); 96 ~Keyboard();
97 97
98 void resetState(); 98 void resetState();
99 99
100 void mousePressEvent(QMouseEvent*); 100 void mousePressEvent(QMouseEvent*);
101 void mouseReleaseEvent(QMouseEvent*); 101 void mouseReleaseEvent(QMouseEvent*);
102 void resizeEvent(QResizeEvent*); 102 void resizeEvent(QResizeEvent*);
103 void paintEvent(QPaintEvent* e); 103 void paintEvent(QPaintEvent* e);
104 //void timerEvent(QTimerEvent* e); 104 //void timerEvent(QTimerEvent* e);
105 void drawKeyboard( QPainter &p, int row = -1, int col = -1); 105 void drawKeyboard( QPainter &p, int row = -1, int col = -1);
106 106
107 QSize sizeHint() const; 107 QSize sizeHint() const;
108 108
109signals: 109signals:
110 void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); 110 void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool );
111 111
112private slots: 112private slots:
113 void repeat(); 113 void repeat();
114 void togglePickboard(bool on_off); 114 void togglePickboard(bool on_off);
115 void setMapToDefault(); 115 void setMapToDefault();
116 void setMapToFile(QString file); 116 void setMapToFile(int index);
117 117
118private: 118private:
119 int getKey( int &w, int j = -1 ); 119 int getKey( int &w, int j = -1 );
120 void clearHighlight(); 120 void clearHighlight();
121 121
122 bool *shift; 122 bool *shift;
123 bool *lock; 123 bool *lock;
124 bool *ctrl; 124 bool *ctrl;
125 bool *alt; 125 bool *alt;
126 uint useLargeKeys:1; 126 uint useLargeKeys:1;
127 uint usePicks:1; 127 uint usePicks:1;
128 128
129 int pressedKeyRow; 129 int pressedKeyRow;
130 int pressedKeyCol; 130 int pressedKeyCol;
131 131
132 KeyboardPicks *picks; 132 KeyboardPicks *picks;
133 133
134 int keyHeight; 134 int keyHeight;
135 int defaultKeyWidth; 135 int defaultKeyWidth;
136 int xoffs; 136 int xoffs;
137 137
138 int unicode; 138 int unicode;
139 int qkeycode; 139 int qkeycode;
140 int modifiers; 140 int modifiers;
141 141
142 int pressTid; 142 int pressTid;
143 bool pressed; 143 bool pressed;
144 144
145 Keys *keys; 145 Keys *keys;
146 146
147 /* for korean input */ 147 /* for korean input */
148 ushort schar, mchar, echar; 148 ushort schar, mchar, echar;
149 ushort parseKoreanInput(ushort c); 149 ushort parseKoreanInput(ushort c);
150 ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); 150 ushort combineKoreanChars(const ushort s, const ushort m, const ushort e);
151 ushort constoe(const ushort c); 151 ushort constoe(const ushort c);
152 152
153 QTimer *repeatTimer; 153 QTimer *repeatTimer;
154 154
155 ConfigDlg *configdlg; 155 ConfigDlg *configdlg;
156}; 156};
157 157
158 158