summaryrefslogtreecommitdiff
authordrw <drw>2005-06-15 22:54:50 (UTC)
committer drw <drw>2005-06-15 22:54:50 (UTC)
commit7ff2e7bd4620a574f3ff22a951a5904310cfd920 (patch) (unidiff)
tree6d8ffd28aadf00901b3ab560464794aded3efc76
parente0205bac48b9d23af9feb48004c24fcf7a5e8200 (diff)
downloadopie-7ff2e7bd4620a574f3ff22a951a5904310cfd920.zip
opie-7ff2e7bd4620a574f3ff22a951a5904310cfd920.tar.gz
opie-7ff2e7bd4620a574f3ff22a951a5904310cfd920.tar.bz2
Resource -> OResource
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/jumpx/config.in2
-rw-r--r--inputmethods/jumpx/jumpx.pro2
-rw-r--r--inputmethods/jumpx/keyboard.cpp18
-rw-r--r--inputmethods/jumpx/opie-jumpx.control2
-rw-r--r--inputmethods/kjumpx/config.in2
-rw-r--r--inputmethods/kjumpx/keyboard.cpp60
-rw-r--r--inputmethods/kjumpx/kjumpx.pro2
-rw-r--r--inputmethods/kjumpx/opie-kjumpx.control2
-rw-r--r--inputmethods/multikey/config.in2
-rw-r--r--inputmethods/multikey/configdlg.cpp13
-rw-r--r--inputmethods/multikey/multikey.pro2
-rw-r--r--inputmethods/multikey/opie-multikey.control2
12 files changed, 56 insertions, 53 deletions
diff --git a/inputmethods/jumpx/config.in b/inputmethods/jumpx/config.in
index f2779f8..33645d9 100644
--- a/inputmethods/jumpx/config.in
+++ b/inputmethods/jumpx/config.in
@@ -1,4 +1,4 @@
1 config JUMPX 1 config JUMPX
2 boolean "opie-jumpx (keyboard optimized for single finger/stylus input)" 2 boolean "opie-jumpx (keyboard optimized for single finger/stylus input)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/inputmethods/jumpx/jumpx.pro b/inputmethods/jumpx/jumpx.pro
index c8b2185..e13deb9 100644
--- a/inputmethods/jumpx/jumpx.pro
+++ b/inputmethods/jumpx/jumpx.pro
@@ -1,15 +1,15 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = keyboard.h \ 3HEADERS = keyboard.h \
4 keyboardimpl.h 4 keyboardimpl.h
5SOURCES = keyboard.cpp \ 5SOURCES = keyboard.cpp \
6 keyboardimpl.cpp 6 keyboardimpl.cpp
7TARGET = qjumpx 7TARGET = qjumpx
8DESTDIR = ../../plugins/inputmethods 8DESTDIR = ../../plugins/inputmethods
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += $(OPIEDIR)/include 10DEPENDPATH += $(OPIEDIR)/include
11LIBS += -lqpe 11LIBS += -lqpe -lopiecore2
12VERSION = 1.0.0 12VERSION = 1.0.0
13 13
14include( $(OPIEDIR)/include.pro ) 14include( $(OPIEDIR)/include.pro )
15target.path = $$prefix/plugins/inputmethods 15target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/jumpx/keyboard.cpp b/inputmethods/jumpx/keyboard.cpp
index 0cfb4be..79f0d5d 100644
--- a/inputmethods/jumpx/keyboard.cpp
+++ b/inputmethods/jumpx/keyboard.cpp
@@ -1,525 +1,525 @@
1/**************************************************************************************94x78** 1/**************************************************************************************94x78**
2** 2**
3** This file may be distributed and/or modified under the terms of the 3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software 4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the 5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file. 6** packaging of this file.
7** 7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10** 10**
11*********************************************************************************************/ 11*********************************************************************************************/
12#include "keyboard.h" 12#include "keyboard.h"
13 13
14#include <qpe/resource.h> 14#include <opie2/oresource.h>
15 15
16//#include <iostream.h> 16//#include <iostream.h>
17 17
18 18
19static const int autorepeatDelaytime = 500; // ms 19static const int autorepeatDelaytime = 500; // ms
20static const int autorepeatRate = 20; // chars per second 20static const int autorepeatRate = 20; // chars per second
21 21
22static const int mod1x1 = 0; 22static const int mod1x1 = 0;
23static const int mod1x2 = 23; 23static const int mod1x2 = 23;
24static const int mod1w = mod1x2 - mod1x1; 24static const int mod1w = mod1x2 - mod1x1;
25 25
26static const int letterx1 = 27; 26static const int letterx1 = 27;
27static const int letterx2 = 129; 27static const int letterx2 = 129;
28static const int letterw = 17; 28static const int letterw = 17;
29static const int letterh = 14; 29static const int letterh = 14;
30 30
31static const int num1x1 = 130; 31static const int num1x1 = 130;
32static const int num1x2 = 137; 32static const int num1x2 = 137;
33static const int num1w = num1x2 - num1x1; 33static const int num1w = num1x2 - num1x1;
34 34
35static const int specialx1 = 138; 35static const int specialx1 = 138;
36static const int specialx2 = 170; 36static const int specialx2 = 170;
37static const int specialw = 16; 37static const int specialw = 16;
38 38
39static const int num2x1 = 171; 39static const int num2x1 = 171;
40static const int num2x2 = 178; 40static const int num2x2 = 178;
41static const int num2w = num2x2 - num2x1; 41static const int num2w = num2x2 - num2x1;
42 42
43static const int mod2x1 = 179; 43static const int mod2x1 = 179;
44static const int mod2x2 = 203; 44static const int mod2x2 = 203;
45static const int mod2w = mod2x2 - mod2x1; 45static const int mod2w = mod2x2 - mod2x1;
46 46
47static const int cursorx1 = 207; 47static const int cursorx1 = 207;
48static const int cursorw = 16; 48static const int cursorw = 16;
49 49
50static const int myParenID = -10; 50static const int myParenID = -10;
51 51
52 52
53typedef struct mapElement 53typedef struct mapElement
54{ 54{
55 int qcode; 55 int qcode;
56 ushort unicode; 56 ushort unicode;
57}; 57};
58 58
59static const mapElement mod1Map[] = { 59static const mapElement mod1Map[] = {
60 { Qt::Key_Escape, 27 }, 60 { Qt::Key_Escape, 27 },
61 { Qt::Key_Tab, 9 }, 61 { Qt::Key_Tab, 9 },
62 { Qt::Key_Return, 13 }, 62 { Qt::Key_Return, 13 },
63 { Qt::Key_Alt, 0 }, 63 { Qt::Key_Alt, 0 },
64 { Qt::Key_Control, 0 }, 64 { Qt::Key_Control, 0 },
65}; 65};
66 66
67static const uchar *const letterMap[] = { 67static const uchar *const letterMap[] = {
68 (const uchar *const)"zvchwk", 68 (const uchar *const)"zvchwk",
69 (const uchar *const)"fitaly", 69 (const uchar *const)"fitaly",
70 (const uchar *const)" ne ", 70 (const uchar *const)" ne ",
71 (const uchar *const)"gdorsb", 71 (const uchar *const)"gdorsb",
72 (const uchar *const)"qjumpx", 72 (const uchar *const)"qjumpx",
73}; 73};
74 74
75static const uchar *const letterMapShift[] = { 75static const uchar *const letterMapShift[] = {
76 (const uchar *const)"ZVCHWK", 76 (const uchar *const)"ZVCHWK",
77 (const uchar *const)"FITALY", 77 (const uchar *const)"FITALY",
78 (const uchar *const)" NE ", 78 (const uchar *const)" NE ",
79 (const uchar *const)"GDORSB", 79 (const uchar *const)"GDORSB",
80 (const uchar *const)"QJUMPX", 80 (const uchar *const)"QJUMPX",
81}; 81};
82 82
83static const uchar *const num1Map = (const uchar *const)"12345"; 83static const uchar *const num1Map = (const uchar *const)"12345";
84 84
85static const uchar *const specialMap[] = { 85static const uchar *const specialMap[] = {
86 (const uchar *const)"-+", 86 (const uchar *const)"-+",
87 (const uchar *const)"*!", 87 (const uchar *const)"*!",
88 (const uchar *const)",'", 88 (const uchar *const)",'",
89 (const uchar *const)".%", 89 (const uchar *const)".%",
90 (const uchar *const)"/$", 90 (const uchar *const)"/$",
91}; 91};
92 92
93static const uchar *const specialMapShift[] = { 93static const uchar *const specialMapShift[] = {
94 (const uchar *const)"_=", 94 (const uchar *const)"_=",
95 (const uchar *const)"#?", 95 (const uchar *const)"#?",
96 (const uchar *const)";\"", 96 (const uchar *const)";\"",
97 (const uchar *const)":|", 97 (const uchar *const)":|",
98 (const uchar *const)"\\&", 98 (const uchar *const)"\\&",
99}; 99};
100 100
101static const uchar *const specialMapParen[] = { 101static const uchar *const specialMapParen[] = {
102 (const uchar *const)"()", 102 (const uchar *const)"()",
103 (const uchar *const)"[]", 103 (const uchar *const)"[]",
104 (const uchar *const)"{}", 104 (const uchar *const)"{}",
105 (const uchar *const)"<>", 105 (const uchar *const)"<>",
106 (const uchar *const)"@~", 106 (const uchar *const)"@~",
107}; 107};
108 108
109static const uchar *const num2Map = (const uchar *const)"67890"; 109static const uchar *const num2Map = (const uchar *const)"67890";
110 110
111static const mapElement mod2Map[] = { 111static const mapElement mod2Map[] = {
112 { Qt::Key_Backspace, 8 }, 112 { Qt::Key_Backspace, 8 },
113 { Qt::Key_Delete, 0 }, 113 { Qt::Key_Delete, 0 },
114 { Qt::Key_Return, 13 }, 114 { Qt::Key_Return, 13 },
115 { Qt::Key_Shift, 0 }, 115 { Qt::Key_Shift, 0 },
116 { myParenID, 0 }, 116 { myParenID, 0 },
117}; 117};
118 118
119static const int cursorMap[][2] = { 119static const int cursorMap[][2] = {
120 { Qt::Key_Home, Qt::Key_PageUp }, 120 { Qt::Key_Home, Qt::Key_PageUp },
121 { Qt::Key_End, Qt::Key_PageDown }, 121 { Qt::Key_End, Qt::Key_PageDown },
122 { Qt::Key_Up, Qt::Key_Up }, 122 { Qt::Key_Up, Qt::Key_Up },
123 { Qt::Key_Left, Qt::Key_Right }, 123 { Qt::Key_Left, Qt::Key_Right },
124 { Qt::Key_Down, Qt::Key_Down }, 124 { Qt::Key_Down, Qt::Key_Down },
125}; 125};
126 126
127using namespace JumpX; 127using namespace JumpX;
128 128
129Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : 129Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) :
130 QFrame(parent, name, f), 130 QFrame(parent, name, f),
131 shift(0), paren(0), ctrl(0), alt(0), 131 shift(0), paren(0), ctrl(0), alt(0),
132 pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), 132 pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0),
133 isnoncont(false), 133 isnoncont(false),
134 slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), 134 slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0),
135 enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), 135 enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL),
136 releasedPix(NULL), pressedPix(NULL) 136 releasedPix(NULL), pressedPix(NULL)
137{ 137{
138 //setPalette(QPalette(QColor(240,240,230))); // Beige! 138 //setPalette(QPalette(QColor(240,240,230))); // Beige!
139 139
140 releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("jumpx/released"); 140 releasedPlain = releasedShift = releasedParen = Opie::Core::OResource::loadPixmap("jumpx/released");
141 pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("jumpx/pressed"); 141 pressedPlain = pressedShift = pressedParen = Opie::Core::OResource::loadPixmap("jumpx/pressed");
142 pressedDigit = Resource::loadPixmap("jumpx/pressed"); 142 pressedDigit = Opie::Core::OResource::loadPixmap("jumpx/pressed");
143 143
144 QPixmap tmp; 144 QPixmap tmp;
145 145
146 tmp = Resource::loadPixmap("jumpx/releasedShift"); 146 tmp = Opie::Core::OResource::loadPixmap("jumpx/releasedShift");
147 bitBlt(&releasedShift, letterx1, 0, &tmp); 147 bitBlt(&releasedShift, letterx1, 0, &tmp);
148 148
149 tmp = Resource::loadPixmap("jumpx/releasedParen"); 149 tmp = Opie::Core::OResource::loadPixmap("jumpx/releasedParen");
150 bitBlt(&releasedParen, specialx1, 0, &tmp); 150 bitBlt(&releasedParen, specialx1, 0, &tmp);
151 151
152 tmp = Resource::loadPixmap("jumpx/pressedShift"); 152 tmp = Opie::Core::OResource::loadPixmap("jumpx/pressedShift");
153 bitBlt(&pressedShift, letterx1, 0, &tmp); 153 bitBlt(&pressedShift, letterx1, 0, &tmp);
154 154
155 tmp = Resource::loadPixmap("jumpx/pressedParen"); 155 tmp = Opie::Core::OResource::loadPixmap("jumpx/pressedParen");
156 bitBlt(&pressedParen, specialx1, 0, &tmp); 156 bitBlt(&pressedParen, specialx1, 0, &tmp);
157 157
158 tmp = Resource::loadPixmap("jumpx/pressedDigit"); 158 tmp = Opie::Core::OResource::loadPixmap("jumpx/pressedDigit");
159 bitBlt(&pressedDigit, specialx1, 0, &tmp); 159 bitBlt(&pressedDigit, specialx1, 0, &tmp);
160 160
161 offscreen = QPixmap( releasedPlain ); 161 offscreen = QPixmap( releasedPlain );
162 162
163 releasedPix = &releasedPlain; 163 releasedPix = &releasedPlain;
164 pressedPix = &pressedPlain; 164 pressedPix = &pressedPlain;
165 slidePix = &pressedPlain; 165 slidePix = &pressedPlain;
166 166
167 delayTimer = new QTimer(this); 167 delayTimer = new QTimer(this);
168 rateTimer = new QTimer(this); 168 rateTimer = new QTimer(this);
169 connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); 169 connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) );
170 connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); 170 connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) );
171} 171}
172 172
173void Keyboard::resizeEvent(QResizeEvent*) 173void Keyboard::resizeEvent(QResizeEvent*)
174{ 174{
175 //cout << "resizeEvent()" << endl; 175 //cout << "resizeEvent()" << endl;
176} 176}
177 177
178void Keyboard::paintEvent(QPaintEvent*) 178void Keyboard::paintEvent(QPaintEvent*)
179{ 179{
180 bitBlt(this, 0, 0, &offscreen); 180 bitBlt(this, 0, 0, &offscreen);
181} 181}
182 182
183void Keyboard::mousePressEvent(QMouseEvent *e) 183void Keyboard::mousePressEvent(QMouseEvent *e)
184{ 184{
185 pressedx = -1; 185 pressedx = -1;
186 pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; 186 pressedKeyUnicode = pressedKeyQcode = pressedMod = 0;
187 187
188 int x = e->x(); 188 int x = e->x();
189 int y = e->y(); 189 int y = e->y();
190 190
191 int row = (y - 1) / letterh; 191 int row = (y - 1) / letterh;
192 192
193 if ( x <= mod1x2 ) // mod1 193 if ( x <= mod1x2 ) // mod1
194 { 194 {
195 pressedx = mod1x1; 195 pressedx = mod1x1;
196 pressedy = row * letterh; 196 pressedy = row * letterh;
197 pressedw = mod1w + 1; 197 pressedw = mod1w + 1;
198 pressedh = letterh + 1; 198 pressedh = letterh + 1;
199 if ( row == 2 ) // return 199 if ( row == 2 ) // return
200 { 200 {
201 pressed2x = mod2x1; 201 pressed2x = mod2x1;
202 pressed2y = 2 * letterh; 202 pressed2y = 2 * letterh;
203 pressed2w = mod2w + 1; 203 pressed2w = mod2w + 1;
204 pressed2h = letterh + 1; 204 pressed2h = letterh + 1;
205 isnoncont = true; 205 isnoncont = true;
206 } 206 }
207 else if ( row == 3 ) // alt 207 else if ( row == 3 ) // alt
208 alt = 1; 208 alt = 1;
209 else if ( row == 4 ) // ctrl 209 else if ( row == 4 ) // ctrl
210 ctrl = 1; 210 ctrl = 1;
211 pressedKeyUnicode = mod1Map[row].unicode; 211 pressedKeyUnicode = mod1Map[row].unicode;
212 pressedKeyQcode = mod1Map[row].qcode; 212 pressedKeyQcode = mod1Map[row].qcode;
213 } 213 }
214 else if ( x >= letterx1 && x <= letterx2 ) // letter 214 else if ( x >= letterx1 && x <= letterx2 ) // letter
215 { 215 {
216 int column = (x - letterx1 - 1) / letterw; 216 int column = (x - letterx1 - 1) / letterw;
217 QChar temp; 217 QChar temp;
218 if ( shift ) 218 if ( shift )
219 temp = QChar( letterMapShift[row][column] ); 219 temp = QChar( letterMapShift[row][column] );
220 else 220 else
221 temp = QChar( letterMap[row][column] ); 221 temp = QChar( letterMap[row][column] );
222 if ( temp == ' ' ) // space 222 if ( temp == ' ' ) // space
223 { 223 {
224 if ( column < 3 ) 224 if ( column < 3 )
225 { 225 {
226 pressedx = letterx1; 226 pressedx = letterx1;
227 pressed2x = letterx1 + letterw * 4; 227 pressed2x = letterx1 + letterw * 4;
228 } 228 }
229 else 229 else
230 { 230 {
231 pressedx = letterx1 + letterw * 4; 231 pressedx = letterx1 + letterw * 4;
232 pressed2x = letterx1; 232 pressed2x = letterx1;
233 } 233 }
234 pressedy = pressed2y = row * letterh; 234 pressedy = pressed2y = row * letterh;
235 pressedw = pressed2w = letterw * 2 + 1; 235 pressedw = pressed2w = letterw * 2 + 1;
236 pressedh = pressed2h = letterh + 1; 236 pressedh = pressed2h = letterh + 1;
237 isnoncont = true; 237 isnoncont = true;
238 } 238 }
239 else 239 else
240 { 240 {
241 pressedx = letterx1 + column * letterw; 241 pressedx = letterx1 + column * letterw;
242 pressedy = row * letterh; 242 pressedy = row * letterh;
243 pressedw = letterw + 1; 243 pressedw = letterw + 1;
244 pressedh = letterh + 1; 244 pressedh = letterh + 1;
245 } 245 }
246 pressedKeyUnicode = temp.unicode(); 246 pressedKeyUnicode = temp.unicode();
247 pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode(); 247 pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode();
248 if ( temp == ' ' ) 248 if ( temp == ' ' )
249 { 249 {
250 slideKeyUnicodeH = slideKeyUnicodeV = 8; 250 slideKeyUnicodeH = slideKeyUnicodeV = 8;
251 slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace; 251 slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace;
252 } 252 }
253 else if ( temp == temp.lower() ) 253 else if ( temp == temp.lower() )
254 { 254 {
255 slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode(); 255 slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode();
256 slidePixH = slidePixV = &pressedShift; 256 slidePixH = slidePixV = &pressedShift;
257 } 257 }
258 else 258 else
259 { 259 {
260 slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode(); 260 slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode();
261 slidePixH = slidePixV = &pressedPlain; 261 slidePixH = slidePixV = &pressedPlain;
262 } 262 }
263 enableMouseTracking = true; 263 enableMouseTracking = true;
264 } 264 }
265 else if ( x >= num1x1 && x <= num1x2 ) // num1 265 else if ( x >= num1x1 && x <= num1x2 ) // num1
266 { 266 {
267 pressedx = num1x1; 267 pressedx = num1x1;
268 pressedy = row * letterh; 268 pressedy = row * letterh;
269 pressedw = num1w + 1; 269 pressedw = num1w + 1;
270 pressedh = letterh + 1; 270 pressedh = letterh + 1;
271 QChar temp = QChar( num1Map[row] ); 271 QChar temp = QChar( num1Map[row] );
272 pressedKeyUnicode = pressedKeyQcode = temp.unicode(); 272 pressedKeyUnicode = pressedKeyQcode = temp.unicode();
273 } 273 }
274 else if ( x >= specialx1 && x <= specialx2 ) // special 274 else if ( x >= specialx1 && x <= specialx2 ) // special
275 { 275 {
276 int column = (x - specialx1 - 1) / specialw; 276 int column = (x - specialx1 - 1) / specialw;
277 pressedx = specialx1 + column * specialw; 277 pressedx = specialx1 + column * specialw;
278 pressedy = row * letterh; 278 pressedy = row * letterh;
279 pressedw = specialw + 1; 279 pressedw = specialw + 1;
280 pressedh = letterh + 1; 280 pressedh = letterh + 1;
281 QChar temp; 281 QChar temp;
282 if ( shift ) 282 if ( shift )
283 temp = QChar( specialMapShift[row][column] ); 283 temp = QChar( specialMapShift[row][column] );
284 else if ( paren ) 284 else if ( paren )
285 temp = QChar( specialMapParen[row][column] ); 285 temp = QChar( specialMapParen[row][column] );
286 else 286 else
287 temp = QChar( specialMap[row][column] ); 287 temp = QChar( specialMap[row][column] );
288 pressedKeyUnicode = pressedKeyQcode = temp.unicode(); 288 pressedKeyUnicode = pressedKeyQcode = temp.unicode();
289 slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV = 289 slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV =
290 QChar('0').unicode() + ( 5 * column + row + 1 ) % 10; 290 QChar('0').unicode() + ( 5 * column + row + 1 ) % 10;
291 slidePixH = slidePixV = &pressedDigit; 291 slidePixH = slidePixV = &pressedDigit;
292 if ( shift ) 292 if ( shift )
293 { 293 {
294 slideKeyUnicodeV = slideKeyQcodeV = 294 slideKeyUnicodeV = slideKeyQcodeV =
295 QChar( specialMap[row][column] ).unicode(); 295 QChar( specialMap[row][column] ).unicode();
296 slidePixV = &pressedPlain; 296 slidePixV = &pressedPlain;
297 } 297 }
298 else if ( !(shift || paren) ) 298 else if ( !(shift || paren) )
299 { 299 {
300 slideKeyUnicodeV = slideKeyQcodeV = 300 slideKeyUnicodeV = slideKeyQcodeV =
301 QChar( specialMapShift[row][column] ).unicode(); 301 QChar( specialMapShift[row][column] ).unicode();
302 slidePixV = &pressedShift; 302 slidePixV = &pressedShift;
303 } 303 }
304 enableMouseTracking = true; 304 enableMouseTracking = true;
305 } 305 }
306 else if ( x >= num2x1 && x <= num2x2 ) // num2 306 else if ( x >= num2x1 && x <= num2x2 ) // num2
307 { 307 {
308 pressedx = num2x1; 308 pressedx = num2x1;
309 pressedy = row * letterh; 309 pressedy = row * letterh;
310 pressedw = num2w + 1; 310 pressedw = num2w + 1;
311 pressedh = letterh + 1; 311 pressedh = letterh + 1;
312 QChar temp = QChar( num2Map[row] ); 312 QChar temp = QChar( num2Map[row] );
313 pressedKeyUnicode = pressedKeyQcode = temp.unicode(); 313 pressedKeyUnicode = pressedKeyQcode = temp.unicode();
314 } 314 }
315 else if ( x >= mod2x1 && x <= mod2x2 ) // mod2 315 else if ( x >= mod2x1 && x <= mod2x2 ) // mod2
316 { 316 {
317 pressedx = mod2x1; 317 pressedx = mod2x1;
318 pressedy = row * letterh; 318 pressedy = row * letterh;
319 pressedw = mod2w + 1; 319 pressedw = mod2w + 1;
320 pressedh = letterh + 1; 320 pressedh = letterh + 1;
321 if ( row == 2 ) // return 321 if ( row == 2 ) // return
322 { 322 {
323 pressed2x = mod1x1; 323 pressed2x = mod1x1;
324 pressed2y = 2 * letterh; 324 pressed2y = 2 * letterh;
325 pressed2w = mod2w + 1; 325 pressed2w = mod2w + 1;
326 pressed2h = letterh + 1; 326 pressed2h = letterh + 1;
327 isnoncont = true; 327 isnoncont = true;
328 } 328 }
329 pressedKeyUnicode = mod2Map[row].unicode; 329 pressedKeyUnicode = mod2Map[row].unicode;
330 pressedKeyQcode = mod2Map[row].qcode; 330 pressedKeyQcode = mod2Map[row].qcode;
331 331
332 if ( row == 3 ) // shift 332 if ( row == 3 ) // shift
333 { 333 {
334 paren = 0; 334 paren = 0;
335 switch ( shift ) 335 switch ( shift )
336 { 336 {
337 case 0: 337 case 0:
338 { 338 {
339 shift = 1; 339 shift = 1;
340 releasedPix = &releasedShift; 340 releasedPix = &releasedShift;
341 pressedPix = &pressedShift; 341 pressedPix = &pressedShift;
342 bitBlt( &offscreen, 0, 0, releasedPix ); 342 bitBlt( &offscreen, 0, 0, releasedPix );
343 break; 343 break;
344 } 344 }
345 case 1: 345 case 1:
346 { 346 {
347 shift = 2; 347 shift = 2;
348 break; 348 break;
349 } 349 }
350 case 2: 350 case 2:
351 { 351 {
352 shift = 0; 352 shift = 0;
353 releasedPix = &releasedPlain; 353 releasedPix = &releasedPlain;
354 pressedPix = &pressedPlain; 354 pressedPix = &pressedPlain;
355 bitBlt( &offscreen, 0, 0, releasedPix ); 355 bitBlt( &offscreen, 0, 0, releasedPix );
356 break; 356 break;
357 } 357 }
358 } 358 }
359 } 359 }
360 else if ( row == 4 ) // parenthesis 360 else if ( row == 4 ) // parenthesis
361 { 361 {
362 shift = 0; 362 shift = 0;
363 switch ( paren ) 363 switch ( paren )
364 { 364 {
365 case 0: 365 case 0:
366 { 366 {
367 paren = 1; 367 paren = 1;
368 releasedPix = &releasedParen; 368 releasedPix = &releasedParen;
369 pressedPix = &pressedParen; 369 pressedPix = &pressedParen;
370 bitBlt( &offscreen, 0, 0, releasedPix ); 370 bitBlt( &offscreen, 0, 0, releasedPix );
371 break; 371 break;
372 } 372 }
373 case 1: 373 case 1:
374 { 374 {
375 paren = 2; 375 paren = 2;
376 break; 376 break;
377 } 377 }
378 case 2: 378 case 2:
379 { 379 {
380 paren = 0; 380 paren = 0;
381 releasedPix = &releasedPlain; 381 releasedPix = &releasedPlain;
382 pressedPix = &pressedPlain; 382 pressedPix = &pressedPlain;
383 bitBlt( &offscreen, 0, 0, releasedPix ); 383 bitBlt( &offscreen, 0, 0, releasedPix );
384 break; 384 break;
385 } 385 }
386 } 386 }
387 } 387 }
388 } 388 }
389 else if ( x >= cursorx1 ) // cursor 389 else if ( x >= cursorx1 ) // cursor
390 { 390 {
391 int column = (x - cursorx1 - 1) / cursorw; 391 int column = (x - cursorx1 - 1) / cursorw;
392 if ( row == 2 || row == 4 ) 392 if ( row == 2 || row == 4 )
393 pressedx = cursorx1 + cursorw / 2; 393 pressedx = cursorx1 + cursorw / 2;
394 else 394 else
395 pressedx = cursorx1 + column * cursorw; 395 pressedx = cursorx1 + column * cursorw;
396 pressedy = row * letterh; 396 pressedy = row * letterh;
397 pressedw = cursorw + 1; 397 pressedw = cursorw + 1;
398 pressedh = letterh + 1; 398 pressedh = letterh + 1;
399 pressedKeyQcode = cursorMap[row][column]; 399 pressedKeyQcode = cursorMap[row][column];
400 } 400 }
401 401
402 pressedMod = ( shift ? Qt::ShiftButton : 0 ) | 402 pressedMod = ( shift ? Qt::ShiftButton : 0 ) |
403 ( ctrl ? Qt::ControlButton : 0 ) | 403 ( ctrl ? Qt::ControlButton : 0 ) |
404 ( alt ? Qt::AltButton : 0 ); 404 ( alt ? Qt::AltButton : 0 );
405 405
406 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); 406 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false );
407 delayTimer->start( autorepeatDelaytime, true ); 407 delayTimer->start( autorepeatDelaytime, true );
408 408
409 if ( pressedx == -1 ) 409 if ( pressedx == -1 )
410 return; 410 return;
411 411
412 bitBlt( &offscreen, pressedx, pressedy, 412 bitBlt( &offscreen, pressedx, pressedy,
413 pressedPix, pressedx, pressedy, pressedw, pressedh ); 413 pressedPix, pressedx, pressedy, pressedw, pressedh );
414 if ( isnoncont ) 414 if ( isnoncont )
415 bitBlt( &offscreen, pressed2x, pressed2y, 415 bitBlt( &offscreen, pressed2x, pressed2y,
416 pressedPix, pressed2x, pressed2y, pressed2w, pressed2h ); 416 pressedPix, pressed2x, pressed2y, pressed2w, pressed2h );
417 417
418 repaint( false ); 418 repaint( false );
419} 419}
420 420
421void Keyboard::mouseReleaseEvent(QMouseEvent*) 421void Keyboard::mouseReleaseEvent(QMouseEvent*)
422{ 422{
423 //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl; 423 //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl;
424 424
425 delayTimer->stop(); 425 delayTimer->stop();
426 rateTimer->stop(); 426 rateTimer->stop();
427 enableMouseTracking = false; 427 enableMouseTracking = false;
428 428
429 if ( pressedx == -1 ) 429 if ( pressedx == -1 )
430 return; 430 return;
431 431
432 if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift ) 432 if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift )
433 return; 433 return;
434 if ( paren == 2 && pressedKeyQcode == myParenID ) 434 if ( paren == 2 && pressedKeyQcode == myParenID )
435 return; 435 return;
436 436
437 if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift ) 437 if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift )
438 { 438 {
439 shift = 0; 439 shift = 0;
440 releasedPix = &releasedPlain; 440 releasedPix = &releasedPlain;
441 pressedPix = &pressedPlain; 441 pressedPix = &pressedPlain;
442 bitBlt( &offscreen, 0, 0, releasedPix ); 442 bitBlt( &offscreen, 0, 0, releasedPix );
443 } 443 }
444 444
445 if ( paren == 1 && pressedKeyQcode != myParenID ) 445 if ( paren == 1 && pressedKeyQcode != myParenID )
446 { 446 {
447 paren = 0; 447 paren = 0;
448 releasedPix = &releasedPlain; 448 releasedPix = &releasedPlain;
449 pressedPix = &pressedPlain; 449 pressedPix = &pressedPlain;
450 bitBlt( &offscreen, 0, 0, releasedPix ); 450 bitBlt( &offscreen, 0, 0, releasedPix );
451 } 451 }
452 452
453 if ( alt && pressedKeyQcode != Qt::Key_Alt ) 453 if ( alt && pressedKeyQcode != Qt::Key_Alt )
454 alt = 0; 454 alt = 0;
455 if ( ctrl && pressedKeyQcode != Qt::Key_Control ) 455 if ( ctrl && pressedKeyQcode != Qt::Key_Control )
456 ctrl = 0; 456 ctrl = 0;
457 457
458 bitBlt( &offscreen, pressedx, pressedy, 458 bitBlt( &offscreen, pressedx, pressedy,
459 releasedPix, pressedx, pressedy, pressedw, pressedh ); 459 releasedPix, pressedx, pressedy, pressedw, pressedh );
460 460
461 if ( isnoncont ) 461 if ( isnoncont )
462 { 462 {
463 isnoncont = false; 463 isnoncont = false;
464 bitBlt( &offscreen, pressed2x, pressed2y, 464 bitBlt( &offscreen, pressed2x, pressed2y,
465 releasedPix, pressed2x, pressed2y, pressed2w, pressed2h ); 465 releasedPix, pressed2x, pressed2y, pressed2w, pressed2h );
466 } 466 }
467 467
468 repaint( false ); 468 repaint( false );
469} 469}
470 470
471void Keyboard::mouseMoveEvent(QMouseEvent *e) 471void Keyboard::mouseMoveEvent(QMouseEvent *e)
472{ 472{
473 if ( !enableMouseTracking ) 473 if ( !enableMouseTracking )
474 return; 474 return;
475 475
476 if ( e->x() < pressedx || e->x() >= pressedx + pressedw ) 476 if ( e->x() < pressedx || e->x() >= pressedx + pressedw )
477 { 477 {
478 pressedKeyUnicode = slideKeyUnicodeH; 478 pressedKeyUnicode = slideKeyUnicodeH;
479 pressedKeyQcode = slideKeyQcodeH; 479 pressedKeyQcode = slideKeyQcodeH;
480 slidePix = slidePixH; 480 slidePix = slidePixH;
481 } 481 }
482 else if ( e->y() < pressedy || e->y() >= pressedy + pressedh ) 482 else if ( e->y() < pressedy || e->y() >= pressedy + pressedh )
483 { 483 {
484 pressedKeyUnicode = slideKeyUnicodeV; 484 pressedKeyUnicode = slideKeyUnicodeV;
485 pressedKeyQcode = slideKeyQcodeV; 485 pressedKeyQcode = slideKeyQcodeV;
486 slidePix = slidePixV; 486 slidePix = slidePixV;
487 } 487 }
488 else 488 else
489 return; 489 return;
490 490
491 enableMouseTracking = false; 491 enableMouseTracking = false;
492 492
493 delayTimer->stop(); 493 delayTimer->stop();
494 rateTimer->stop(); 494 rateTimer->stop();
495 495
496 bitBlt( &offscreen, pressedx, pressedy, 496 bitBlt( &offscreen, pressedx, pressedy,
497 slidePix, pressedx, pressedy, pressedw, pressedh ); 497 slidePix, pressedx, pressedy, pressedw, pressedh );
498 498
499 emit key( 8, Qt::Key_Backspace, pressedMod, true, false ); 499 emit key( 8, Qt::Key_Backspace, pressedMod, true, false );
500 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); 500 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false );
501 delayTimer->start( autorepeatDelaytime, true ); 501 delayTimer->start( autorepeatDelaytime, true );
502 502
503 repaint( false ); 503 repaint( false );
504} 504}
505 505
506void Keyboard::delayTimerDone() 506void Keyboard::delayTimerDone()
507{ 507{
508 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); 508 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true );
509 rateTimer->start( 1000/autorepeatRate, false ); 509 rateTimer->start( 1000/autorepeatRate, false );
510} 510}
511 511
512void Keyboard::rateTimerDone() 512void Keyboard::rateTimerDone()
513{ 513{
514 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); 514 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true );
515} 515}
516 516
517QSize Keyboard::sizeHint() const 517QSize Keyboard::sizeHint() const
518{ 518{
519 return offscreen.size(); 519 return offscreen.size();
520} 520}
521 521
522void Keyboard::resetState() 522void Keyboard::resetState()
523{ 523{
524 //cout << "resetState()" << endl; 524 //cout << "resetState()" << endl;
525} 525}
diff --git a/inputmethods/jumpx/opie-jumpx.control b/inputmethods/jumpx/opie-jumpx.control
index b8664cc..30771b1 100644
--- a/inputmethods/jumpx/opie-jumpx.control
+++ b/inputmethods/jumpx/opie-jumpx.control
@@ -1,11 +1,11 @@
1Package: opie-jumpx 1Package: opie-jumpx
2Files: plugins/inputmethods/libqjumpx.so* pics/jumpx 2Files: plugins/inputmethods/libqjumpx.so* pics/jumpx
3Priority: optional 3Priority: optional
4Section: opie/inputmethods 4Section: opie/inputmethods
5Maintainer: Markus Gritsch <gritsch@iue.tuwien.ac.at> 5Maintainer: Markus Gritsch <gritsch@iue.tuwien.ac.at>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal, libopiecore2
8License: GPL 8License: GPL
9Description: JumpX input method 9Description: JumpX input method
10 Keyboard-like input method for the Opie environment. 10 Keyboard-like input method for the Opie environment.
11Version: $QPE_VERSION$EXTRAVERSION 11Version: $QPE_VERSION$EXTRAVERSION
diff --git a/inputmethods/kjumpx/config.in b/inputmethods/kjumpx/config.in
index 8ccef5b..0c4e9d4 100644
--- a/inputmethods/kjumpx/config.in
+++ b/inputmethods/kjumpx/config.in
@@ -1,4 +1,4 @@
1 config KJUMPX 1 config KJUMPX
2 boolean "opie-kjumpx (korean keyboard optimized for single finger/stylus input)" 2 boolean "opie-kjumpx (korean keyboard optimized for single finger/stylus input)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/inputmethods/kjumpx/keyboard.cpp b/inputmethods/kjumpx/keyboard.cpp
index dc44805..4e99f40 100644
--- a/inputmethods/kjumpx/keyboard.cpp
+++ b/inputmethods/kjumpx/keyboard.cpp
@@ -1,856 +1,856 @@
1/**************************************************************************************94x78** 1/**************************************************************************************94x78**
2** 2**
3** This file may be distributed and/or modified under the terms of the 3** This file may be distributed and/or modified under the terms of the
4** GNU General Public License version 2 as published by the Free Software 4** GNU General Public License version 2 as published by the Free Software
5** Foundation and appearing in the file LICENSE.GPL included in the 5** Foundation and appearing in the file LICENSE.GPL included in the
6** packaging of this file. 6** packaging of this file.
7** 7**
8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 8** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 9** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10** 10**
11*********************************************************************************************/ 11*********************************************************************************************/
12#include "keyboard.h" 12#include "keyboard.h"
13 13
14#include <qpe/resource.h> 14#include <opie2/oresource.h>
15 15
16//#include <iostream.h> 16//#include <iostream.h>
17 17
18 18
19static const int autorepeatDelaytime = 500; // ms 19static const int autorepeatDelaytime = 500; // ms
20static const int autorepeatRate = 20; // chars per second 20static const int autorepeatRate = 20; // chars per second
21 21
22static const int mod1x1 = 0; 22static const int mod1x1 = 0;
23static const int mod1x2 = 23; 23static const int mod1x2 = 23;
24static const int mod1w = mod1x2 - mod1x1; 24static const int mod1w = mod1x2 - mod1x1;
25 25
26static const int letterx1 = 27; 26static const int letterx1 = 27;
27static const int letterx2 = 129; 27static const int letterx2 = 129;
28static const int letterw = 17; 28static const int letterw = 17;
29static const int letterh = 14; 29static const int letterh = 14;
30 30
31static const int num1x1 = 130; 31static const int num1x1 = 130;
32static const int num1x2 = 137; 32static const int num1x2 = 137;
33static const int num1w = num1x2 - num1x1; 33static const int num1w = num1x2 - num1x1;
34 34
35static const int specialx1 = 138; 35static const int specialx1 = 138;
36static const int specialx2 = 170; 36static const int specialx2 = 170;
37static const int specialw = 16; 37static const int specialw = 16;
38 38
39static const int num2x1 = 171; 39static const int num2x1 = 171;
40static const int num2x2 = 178; 40static const int num2x2 = 178;
41static const int num2w = num2x2 - num2x1; 41static const int num2w = num2x2 - num2x1;
42 42
43static const int mod2x1 = 179; 43static const int mod2x1 = 179;
44static const int mod2x2 = 203; 44static const int mod2x2 = 203;
45static const int mod2w = mod2x2 - mod2x1; 45static const int mod2w = mod2x2 - mod2x1;
46 46
47static const int cursorx1 = 207; 47static const int cursorx1 = 207;
48static const int cursorw = 16; 48static const int cursorw = 16;
49 49
50static const int myParenID = -10; 50static const int myParenID = -10;
51 51
52 52
53typedef struct mapElement 53typedef struct mapElement
54{ 54{
55 int qcode; 55 int qcode;
56 ushort unicode; 56 ushort unicode;
57}; 57};
58 58
59static const mapElement mod1Map[] = { 59static const mapElement mod1Map[] = {
60 { Qt::Key_Escape, 27 }, 60 { Qt::Key_Escape, 27 },
61 { Qt::Key_Tab, 9 }, 61 { Qt::Key_Tab, 9 },
62 { Qt::Key_Return, 13 }, 62 { Qt::Key_Return, 13 },
63 { Qt::Key_Alt, 0 }, 63 { Qt::Key_Alt, 0 },
64 { Qt::Key_Control, 0 }, 64 { Qt::Key_Control, 0 },
65}; 65};
66 66
67static const uchar *const letterMap[] = { 67static const uchar *const letterMap[] = {
68 (const uchar *const)"zvchwk", 68 (const uchar *const)"zvchwk",
69 (const uchar *const)"fitaly", 69 (const uchar *const)"fitaly",
70 (const uchar *const)" ne ", 70 (const uchar *const)" ne ",
71 (const uchar *const)"gdorsb", 71 (const uchar *const)"gdorsb",
72 (const uchar *const)"qjumpx", 72 (const uchar *const)"qjumpx",
73}; 73};
74 74
75static const ushort kletterMap[][6] = { 75static const ushort kletterMap[][6] = {
76 { 0x110c, 0x1112, 0x1109, 0x116d, 0x1167, 0x1163 }, 76 { 0x110c, 0x1112, 0x1109, 0x116d, 0x1167, 0x1163 },
77 { 0x110f, 0x1105, 0x1100, 0x1161, 0x1175, 0x1162 }, 77 { 0x110f, 0x1105, 0x1100, 0x1161, 0x1175, 0x1162 },
78 { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, 78 { ' ', ' ', 0x110b, 0x1165, ' ', ' ' },
79 { 0x1110, 0x1103, 0x1102, 0x1169, 0x1173, 0x1166 }, 79 { 0x1110, 0x1103, 0x1102, 0x1169, 0x1173, 0x1166 },
80 { 0x110e, 0x1107, 0x1106, 0x1111, 0x116e, 0x1172 }, 80 { 0x110e, 0x1107, 0x1106, 0x1111, 0x116e, 0x1172 },
81}; 81};
82 82
83static const uchar *const letterMapShift[] = { 83static const uchar *const letterMapShift[] = {
84 (const uchar *const)"ZVCHWK", 84 (const uchar *const)"ZVCHWK",
85 (const uchar *const)"FITALY", 85 (const uchar *const)"FITALY",
86 (const uchar *const)" NE ", 86 (const uchar *const)" NE ",
87 (const uchar *const)"GDORSB", 87 (const uchar *const)"GDORSB",
88 (const uchar *const)"QJUMPX", 88 (const uchar *const)"QJUMPX",
89}; 89};
90 90
91static const ushort kletterMapShift[][6] = { 91static const ushort kletterMapShift[][6] = {
92 { 0x110d, 0x1112, 0x110a, 0x116d, 0x1167, 0x1163 }, 92 { 0x110d, 0x1112, 0x110a, 0x116d, 0x1167, 0x1163 },
93 { 0x110f, 0x1105, 0x1101, 0x1161, 0x1175, 0x1164 }, 93 { 0x110f, 0x1105, 0x1101, 0x1161, 0x1175, 0x1164 },
94 { ' ', ' ', 0x110b, 0x1165, ' ', ' ' }, 94 { ' ', ' ', 0x110b, 0x1165, ' ', ' ' },
95 { 0x1110, 0x1104, 0x1102, 0x1169, 0x1173, 0x1168 }, 95 { 0x1110, 0x1104, 0x1102, 0x1169, 0x1173, 0x1168 },
96 { 0x110e, 0x1108, 0x1106, 0x1111, 0x116e, 0x1172 }, 96 { 0x110e, 0x1108, 0x1106, 0x1111, 0x116e, 0x1172 },
97}; 97};
98 98
99static const uchar *const num1Map = (const uchar *const)"12345"; 99static const uchar *const num1Map = (const uchar *const)"12345";
100 100
101static const uchar *const specialMap[] = { 101static const uchar *const specialMap[] = {
102 (const uchar *const)"-+", 102 (const uchar *const)"-+",
103 (const uchar *const)"*!", 103 (const uchar *const)"*!",
104 (const uchar *const)",'", 104 (const uchar *const)",'",
105 (const uchar *const)".%", 105 (const uchar *const)".%",
106 (const uchar *const)"/$", 106 (const uchar *const)"/$",
107}; 107};
108 108
109static const uchar *const specialMapShift[] = { 109static const uchar *const specialMapShift[] = {
110 (const uchar *const)"_=", 110 (const uchar *const)"_=",
111 (const uchar *const)"#?", 111 (const uchar *const)"#?",
112 (const uchar *const)";\"", 112 (const uchar *const)";\"",
113 (const uchar *const)":|", 113 (const uchar *const)":|",
114 (const uchar *const)"\\&", 114 (const uchar *const)"\\&",
115}; 115};
116 116
117static const uchar *const specialMapParen[] = { 117static const uchar *const specialMapParen[] = {
118 (const uchar *const)"()", 118 (const uchar *const)"()",
119 (const uchar *const)"[]", 119 (const uchar *const)"[]",
120 (const uchar *const)"{}", 120 (const uchar *const)"{}",
121 (const uchar *const)"<>", 121 (const uchar *const)"<>",
122 (const uchar *const)"@~", 122 (const uchar *const)"@~",
123}; 123};
124 124
125static const uchar *const num2Map = (const uchar *const)"67890"; 125static const uchar *const num2Map = (const uchar *const)"67890";
126 126
127static const mapElement mod2Map[] = { 127static const mapElement mod2Map[] = {
128 { Qt::Key_Backspace, 8 }, 128 { Qt::Key_Backspace, 8 },
129 { Qt::Key_Delete, 0 }, 129 { Qt::Key_Delete, 0 },
130 { Qt::Key_Return, 13 }, 130 { Qt::Key_Return, 13 },
131 { Qt::Key_Shift, 0 }, 131 { Qt::Key_Shift, 0 },
132 { myParenID, 0 }, 132 { myParenID, 0 },
133}; 133};
134 134
135static const int cursorMap[][2] = { 135static const int cursorMap[][2] = {
136 { Qt::Key_Home, Qt::Key_PageUp }, 136 { Qt::Key_Home, Qt::Key_PageUp },
137 { Qt::Key_End, Qt::Key_PageDown }, 137 { Qt::Key_End, Qt::Key_PageDown },
138 { Qt::Key_Up, Qt::Key_Up }, 138 { Qt::Key_Up, Qt::Key_Up },
139 { Qt::Key_Left, Qt::Key_Right }, 139 { Qt::Key_Left, Qt::Key_Right },
140 { Qt::Key_Down, Qt::Key_Down }, 140 { Qt::Key_Down, Qt::Key_Down },
141}; 141};
142 142
143using namespace KJumpX; 143using namespace KJumpX;
144 144
145Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : 145Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) :
146 QFrame(parent, name, f), 146 QFrame(parent, name, f),
147 shift(0), paren(0), ctrl(0), alt(0), lang(1), lastKey(0), 147 shift(0), paren(0), ctrl(0), alt(0), lang(1), lastKey(0),
148 pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0), 148 pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0),
149 isnoncont(false), 149 isnoncont(false),
150 slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0), 150 slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0),
151 enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL), 151 enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL),
152 releasedPix(NULL), pressedPix(NULL) 152 releasedPix(NULL), pressedPix(NULL)
153{ 153{
154 //setPalette(QPalette(QColor(240,240,230))); // Beige! 154 //setPalette(QPalette(QColor(240,240,230))); // Beige!
155 155
156 releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("kjumpx/released"); 156 releasedPlain = releasedShift = releasedParen = Opie::Core::OResource::loadPixmap("kjumpx/released");
157 pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("kjumpx/pressed"); 157 pressedPlain = pressedShift = pressedParen = Opie::Core::OResource::loadPixmap("kjumpx/pressed");
158 pressedDigit = Resource::loadPixmap("kjumpx/pressed"); 158 pressedDigit = Opie::Core::OResource::loadPixmap("kjumpx/pressed");
159 159
160 QPixmap tmp; 160 QPixmap tmp;
161 161
162 tmp = Resource::loadPixmap("kjumpx/releasedShift"); 162 tmp = Opie::Core::OResource::loadPixmap("kjumpx/releasedShift");
163 bitBlt(&releasedShift, letterx1, 0, &tmp); 163 bitBlt(&releasedShift, letterx1, 0, &tmp);
164 164
165 tmp = Resource::loadPixmap("kjumpx/releasedParen"); 165 tmp = Opie::Core::OResource::loadPixmap("kjumpx/releasedParen");
166 bitBlt(&releasedParen, specialx1, 0, &tmp); 166 bitBlt(&releasedParen, specialx1, 0, &tmp);
167 167
168 tmp = Resource::loadPixmap("kjumpx/pressedShift"); 168 tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedShift");
169 bitBlt(&pressedShift, letterx1, 0, &tmp); 169 bitBlt(&pressedShift, letterx1, 0, &tmp);
170 170
171 tmp = Resource::loadPixmap("kjumpx/pressedParen"); 171 tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedParen");
172 bitBlt(&pressedParen, specialx1, 0, &tmp); 172 bitBlt(&pressedParen, specialx1, 0, &tmp);
173 173
174 tmp = Resource::loadPixmap("kjumpx/pressedDigit"); 174 tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedDigit");
175 bitBlt(&pressedDigit, specialx1, 0, &tmp); 175 bitBlt(&pressedDigit, specialx1, 0, &tmp);
176 176
177 offscreen = QPixmap( releasedPlain ); 177 offscreen = QPixmap( releasedPlain );
178 178
179 releasedPix = &releasedPlain; 179 releasedPix = &releasedPlain;
180 pressedPix = &pressedPlain; 180 pressedPix = &pressedPlain;
181 slidePix = &pressedPlain; 181 slidePix = &pressedPlain;
182 182
183 delayTimer = new QTimer(this); 183 delayTimer = new QTimer(this);
184 rateTimer = new QTimer(this); 184 rateTimer = new QTimer(this);
185 connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) ); 185 connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) );
186 connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) ); 186 connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) );
187} 187}
188 188
189void Keyboard::resizeEvent(QResizeEvent*) 189void Keyboard::resizeEvent(QResizeEvent*)
190{ 190{
191 //cout << "resizeEvent()" << endl; 191 //cout << "resizeEvent()" << endl;
192} 192}
193 193
194void Keyboard::paintEvent(QPaintEvent*) 194void Keyboard::paintEvent(QPaintEvent*)
195{ 195{
196 bitBlt(this, 0, 0, &offscreen); 196 bitBlt(this, 0, 0, &offscreen);
197} 197}
198 198
199void Keyboard::mousePressEvent(QMouseEvent *e) 199void Keyboard::mousePressEvent(QMouseEvent *e)
200{ 200{
201 pressedx = -1; 201 pressedx = -1;
202 pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; 202 pressedKeyUnicode = pressedKeyQcode = pressedMod = 0;
203 203
204 int x = e->x(); 204 int x = e->x();
205 int y = e->y(); 205 int y = e->y();
206 206
207 int row = (y - 1) / letterh; 207 int row = (y - 1) / letterh;
208 208
209 if ( x <= mod1x2 ) // mod1 209 if ( x <= mod1x2 ) // mod1
210 { 210 {
211 pressedx = mod1x1; 211 pressedx = mod1x1;
212 pressedy = row * letterh; 212 pressedy = row * letterh;
213 pressedw = mod1w + 1; 213 pressedw = mod1w + 1;
214 pressedh = letterh + 1; 214 pressedh = letterh + 1;
215 if ( row == 2 ) // return 215 if ( row == 2 ) // return
216 { 216 {
217 pressed2x = mod2x1; 217 pressed2x = mod2x1;
218 pressed2y = 2 * letterh; 218 pressed2y = 2 * letterh;
219 pressed2w = mod2w + 1; 219 pressed2w = mod2w + 1;
220 pressed2h = letterh + 1; 220 pressed2h = letterh + 1;
221 isnoncont = true; 221 isnoncont = true;
222 } 222 }
223 else if ( row == 3 ) // alt 223 else if ( row == 3 ) // alt
224 alt = 1; 224 alt = 1;
225 else if ( row == 4 ) // ctrl 225 else if ( row == 4 ) // ctrl
226 ctrl = 1; 226 ctrl = 1;
227 pressedKeyUnicode = mod1Map[row].unicode; 227 pressedKeyUnicode = mod1Map[row].unicode;
228 pressedKeyQcode = mod1Map[row].qcode; 228 pressedKeyQcode = mod1Map[row].qcode;
229 } 229 }
230 else if ( x >= letterx1 && x <= letterx2 ) // letter 230 else if ( x >= letterx1 && x <= letterx2 ) // letter
231 { 231 {
232 int column = (x - letterx1 - 1) / letterw; 232 int column = (x - letterx1 - 1) / letterw;
233 QChar temp; 233 QChar temp;
234 if (lang == 0) // english 234 if (lang == 0) // english
235 if ( shift ) 235 if ( shift )
236 temp = QChar( letterMapShift[row][column] ); 236 temp = QChar( letterMapShift[row][column] );
237 else 237 else
238 temp = QChar( letterMap[row][column] ); 238 temp = QChar( letterMap[row][column] );
239 else if (lang == 1) // korean 239 else if (lang == 1) // korean
240 if ( shift ) 240 if ( shift )
241 temp = parseKoreanInput( kletterMapShift[row][column] ); 241 temp = parseKoreanInput( kletterMapShift[row][column] );
242 else 242 else
243 temp = parseKoreanInput( kletterMap[row][column] ); 243 temp = parseKoreanInput( kletterMap[row][column] );
244 244
245 if ( temp == ' ' ) // space 245 if ( temp == ' ' ) // space
246 { 246 {
247 if ( column < 3 ) 247 if ( column < 3 )
248 { 248 {
249 pressedx = letterx1; 249 pressedx = letterx1;
250 pressed2x = letterx1 + letterw * 4; 250 pressed2x = letterx1 + letterw * 4;
251 } 251 }
252 else 252 else
253 { 253 {
254 pressedx = letterx1 + letterw * 4; 254 pressedx = letterx1 + letterw * 4;
255 pressed2x = letterx1; 255 pressed2x = letterx1;
256 } 256 }
257 pressedy = pressed2y = row * letterh; 257 pressedy = pressed2y = row * letterh;
258 pressedw = pressed2w = letterw * 2 + 1; 258 pressedw = pressed2w = letterw * 2 + 1;
259 pressedh = pressed2h = letterh + 1; 259 pressedh = pressed2h = letterh + 1;
260 isnoncont = true; 260 isnoncont = true;
261 } 261 }
262 else 262 else
263 { 263 {
264 pressedx = letterx1 + column * letterw; 264 pressedx = letterx1 + column * letterw;
265 pressedy = row * letterh; 265 pressedy = row * letterh;
266 pressedw = letterw + 1; 266 pressedw = letterw + 1;
267 pressedh = letterh + 1; 267 pressedh = letterh + 1;
268 } 268 }
269 pressedKeyUnicode = temp.unicode(); 269 pressedKeyUnicode = temp.unicode();
270 pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode(); 270 pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode();
271 if ( temp == ' ' ) 271 if ( temp == ' ' )
272 { 272 {
273 slideKeyUnicodeH = slideKeyUnicodeV = 8; 273 slideKeyUnicodeH = slideKeyUnicodeV = 8;
274 slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace; 274 slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace;
275 } 275 }
276 else if ( temp == temp.lower() ) 276 else if ( temp == temp.lower() )
277 { 277 {
278 slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode(); 278 slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode();
279 slidePixH = slidePixV = &pressedShift; 279 slidePixH = slidePixV = &pressedShift;
280 } 280 }
281 else 281 else
282 { 282 {
283 slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode(); 283 slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode();
284 slidePixH = slidePixV = &pressedPlain; 284 slidePixH = slidePixV = &pressedPlain;
285 } 285 }
286 enableMouseTracking = true; 286 enableMouseTracking = true;
287 } 287 }
288 else if ( x >= num1x1 && x <= num1x2 ) // num1 288 else if ( x >= num1x1 && x <= num1x2 ) // num1
289 { 289 {
290 pressedx = num1x1; 290 pressedx = num1x1;
291 pressedy = row * letterh; 291 pressedy = row * letterh;
292 pressedw = num1w + 1; 292 pressedw = num1w + 1;
293 pressedh = letterh + 1; 293 pressedh = letterh + 1;
294 QChar temp = QChar( num1Map[row] ); 294 QChar temp = QChar( num1Map[row] );
295 pressedKeyUnicode = pressedKeyQcode = temp.unicode(); 295 pressedKeyUnicode = pressedKeyQcode = temp.unicode();
296 } 296 }
297 else if ( x >= specialx1 && x <= specialx2 ) // special 297 else if ( x >= specialx1 && x <= specialx2 ) // special
298 { 298 {
299 int column = (x - specialx1 - 1) / specialw; 299 int column = (x - specialx1 - 1) / specialw;
300 pressedx = specialx1 + column * specialw; 300 pressedx = specialx1 + column * specialw;
301 pressedy = row * letterh; 301 pressedy = row * letterh;
302 pressedw = specialw + 1; 302 pressedw = specialw + 1;
303 pressedh = letterh + 1; 303 pressedh = letterh + 1;
304 QChar temp; 304 QChar temp;
305 if ( shift ) 305 if ( shift )
306 temp = QChar( specialMapShift[row][column] ); 306 temp = QChar( specialMapShift[row][column] );
307 else if ( paren ) 307 else if ( paren )
308 temp = QChar( specialMapParen[row][column] ); 308 temp = QChar( specialMapParen[row][column] );
309 else 309 else
310 temp = QChar( specialMap[row][column] ); 310 temp = QChar( specialMap[row][column] );
311 pressedKeyUnicode = pressedKeyQcode = temp.unicode(); 311 pressedKeyUnicode = pressedKeyQcode = temp.unicode();
312 slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV = 312 slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV =
313 QChar('0').unicode() + ( 5 * column + row + 1 ) % 10; 313 QChar('0').unicode() + ( 5 * column + row + 1 ) % 10;
314 slidePixH = slidePixV = &pressedDigit; 314 slidePixH = slidePixV = &pressedDigit;
315 if ( shift ) 315 if ( shift )
316 { 316 {
317 slideKeyUnicodeV = slideKeyQcodeV = 317 slideKeyUnicodeV = slideKeyQcodeV =
318 QChar( specialMap[row][column] ).unicode(); 318 QChar( specialMap[row][column] ).unicode();
319 slidePixV = &pressedPlain; 319 slidePixV = &pressedPlain;
320 } 320 }
321 else if ( !(shift || paren) ) 321 else if ( !(shift || paren) )
322 { 322 {
323 slideKeyUnicodeV = slideKeyQcodeV = 323 slideKeyUnicodeV = slideKeyQcodeV =
324 QChar( specialMapShift[row][column] ).unicode(); 324 QChar( specialMapShift[row][column] ).unicode();
325 slidePixV = &pressedShift; 325 slidePixV = &pressedShift;
326 } 326 }
327 enableMouseTracking = true; 327 enableMouseTracking = true;
328 } 328 }
329 else if ( x >= num2x1 && x <= num2x2 ) // num2 329 else if ( x >= num2x1 && x <= num2x2 ) // num2
330 { 330 {
331 pressedx = num2x1; 331 pressedx = num2x1;
332 pressedy = row * letterh; 332 pressedy = row * letterh;
333 pressedw = num2w + 1; 333 pressedw = num2w + 1;
334 pressedh = letterh + 1; 334 pressedh = letterh + 1;
335 QChar temp = QChar( num2Map[row] ); 335 QChar temp = QChar( num2Map[row] );
336 pressedKeyUnicode = pressedKeyQcode = temp.unicode(); 336 pressedKeyUnicode = pressedKeyQcode = temp.unicode();
337 } 337 }
338 else if ( x >= mod2x1 && x <= mod2x2 ) // mod2 338 else if ( x >= mod2x1 && x <= mod2x2 ) // mod2
339 { 339 {
340 pressedx = mod2x1; 340 pressedx = mod2x1;
341 pressedy = row * letterh; 341 pressedy = row * letterh;
342 pressedw = mod2w + 1; 342 pressedw = mod2w + 1;
343 pressedh = letterh + 1; 343 pressedh = letterh + 1;
344 if ( row == 2 ) // return 344 if ( row == 2 ) // return
345 { 345 {
346 pressed2x = mod1x1; 346 pressed2x = mod1x1;
347 pressed2y = 2 * letterh; 347 pressed2y = 2 * letterh;
348 pressed2w = mod2w + 1; 348 pressed2w = mod2w + 1;
349 pressed2h = letterh + 1; 349 pressed2h = letterh + 1;
350 isnoncont = true; 350 isnoncont = true;
351 } 351 }
352 pressedKeyUnicode = mod2Map[row].unicode; 352 pressedKeyUnicode = mod2Map[row].unicode;
353 pressedKeyQcode = mod2Map[row].qcode; 353 pressedKeyQcode = mod2Map[row].qcode;
354 354
355 if ( row == 3 ) // shift 355 if ( row == 3 ) // shift
356 { 356 {
357 paren = 0; 357 paren = 0;
358 switch ( shift ) 358 switch ( shift )
359 { 359 {
360 case 0: 360 case 0:
361 { 361 {
362 shift = 1; 362 shift = 1;
363 releasedPix = &releasedShift; 363 releasedPix = &releasedShift;
364 pressedPix = &pressedShift; 364 pressedPix = &pressedShift;
365 bitBlt( &offscreen, 0, 0, releasedPix ); 365 bitBlt( &offscreen, 0, 0, releasedPix );
366 break; 366 break;
367 } 367 }
368 case 1: 368 case 1:
369 { 369 {
370 shift = 2; 370 shift = 2;
371 break; 371 break;
372 } 372 }
373 case 2: 373 case 2:
374 { 374 {
375 shift = 0; 375 shift = 0;
376 releasedPix = &releasedPlain; 376 releasedPix = &releasedPlain;
377 pressedPix = &pressedPlain; 377 pressedPix = &pressedPlain;
378 bitBlt( &offscreen, 0, 0, releasedPix ); 378 bitBlt( &offscreen, 0, 0, releasedPix );
379 break; 379 break;
380 } 380 }
381 } 381 }
382 } 382 }
383 else if ( row == 4 ) // parenthesis 383 else if ( row == 4 ) // parenthesis
384 { 384 {
385 shift = 0; 385 shift = 0;
386 switch ( paren ) 386 switch ( paren )
387 { 387 {
388 case 0: 388 case 0:
389 { 389 {
390 paren = 1; 390 paren = 1;
391 releasedPix = &releasedParen; 391 releasedPix = &releasedParen;
392 pressedPix = &pressedParen; 392 pressedPix = &pressedParen;
393 bitBlt( &offscreen, 0, 0, releasedPix ); 393 bitBlt( &offscreen, 0, 0, releasedPix );
394 break; 394 break;
395 } 395 }
396 case 1: 396 case 1:
397 { 397 {
398 paren = 2; 398 paren = 2;
399 break; 399 break;
400 } 400 }
401 case 2: 401 case 2:
402 { 402 {
403 paren = 0; 403 paren = 0;
404 releasedPix = &releasedPlain; 404 releasedPix = &releasedPlain;
405 pressedPix = &pressedPlain; 405 pressedPix = &pressedPlain;
406 bitBlt( &offscreen, 0, 0, releasedPix ); 406 bitBlt( &offscreen, 0, 0, releasedPix );
407 break; 407 break;
408 } 408 }
409 } 409 }
410 } 410 }
411 } 411 }
412 else if ( x >= cursorx1 ) // cursor 412 else if ( x >= cursorx1 ) // cursor
413 { 413 {
414 int column = (x - cursorx1 - 1) / cursorw; 414 int column = (x - cursorx1 - 1) / cursorw;
415 if ( row == 2 || row == 4 ) 415 if ( row == 2 || row == 4 )
416 pressedx = cursorx1 + cursorw / 2; 416 pressedx = cursorx1 + cursorw / 2;
417 else 417 else
418 pressedx = cursorx1 + column * cursorw; 418 pressedx = cursorx1 + column * cursorw;
419 pressedy = row * letterh; 419 pressedy = row * letterh;
420 pressedw = cursorw + 1; 420 pressedw = cursorw + 1;
421 pressedh = letterh + 1; 421 pressedh = letterh + 1;
422 pressedKeyQcode = cursorMap[row][column]; 422 pressedKeyQcode = cursorMap[row][column];
423 } 423 }
424 424
425 pressedMod = ( shift ? Qt::ShiftButton : 0 ) | 425 pressedMod = ( shift ? Qt::ShiftButton : 0 ) |
426 ( ctrl ? Qt::ControlButton : 0 ) | 426 ( ctrl ? Qt::ControlButton : 0 ) |
427 ( alt ? Qt::AltButton : 0 ); 427 ( alt ? Qt::AltButton : 0 );
428 428
429 lastKey = pressedKeyUnicode; 429 lastKey = pressedKeyUnicode;
430 430
431 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); 431 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false );
432 delayTimer->start( autorepeatDelaytime, true ); 432 delayTimer->start( autorepeatDelaytime, true );
433 433
434 if ( pressedx == -1 ) 434 if ( pressedx == -1 )
435 return; 435 return;
436 436
437 bitBlt( &offscreen, pressedx, pressedy, 437 bitBlt( &offscreen, pressedx, pressedy,
438 pressedPix, pressedx, pressedy, pressedw, pressedh ); 438 pressedPix, pressedx, pressedy, pressedw, pressedh );
439 if ( isnoncont ) 439 if ( isnoncont )
440 bitBlt( &offscreen, pressed2x, pressed2y, 440 bitBlt( &offscreen, pressed2x, pressed2y,
441 pressedPix, pressed2x, pressed2y, pressed2w, pressed2h ); 441 pressedPix, pressed2x, pressed2y, pressed2w, pressed2h );
442 442
443 repaint( false ); 443 repaint( false );
444} 444}
445 445
446void Keyboard::mouseReleaseEvent(QMouseEvent*) 446void Keyboard::mouseReleaseEvent(QMouseEvent*)
447{ 447{
448 //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl; 448 //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl;
449 449
450 delayTimer->stop(); 450 delayTimer->stop();
451 rateTimer->stop(); 451 rateTimer->stop();
452 enableMouseTracking = false; 452 enableMouseTracking = false;
453 453
454 if ( pressedx == -1 ) 454 if ( pressedx == -1 )
455 return; 455 return;
456 456
457 if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift ) 457 if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift )
458 return; 458 return;
459 if ( paren == 2 && pressedKeyQcode == myParenID ) 459 if ( paren == 2 && pressedKeyQcode == myParenID )
460 return; 460 return;
461 461
462 if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift ) 462 if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift )
463 { 463 {
464 shift = 0; 464 shift = 0;
465 releasedPix = &releasedPlain; 465 releasedPix = &releasedPlain;
466 pressedPix = &pressedPlain; 466 pressedPix = &pressedPlain;
467 bitBlt( &offscreen, 0, 0, releasedPix ); 467 bitBlt( &offscreen, 0, 0, releasedPix );
468 } 468 }
469 469
470 if ( paren == 1 && pressedKeyQcode != myParenID ) 470 if ( paren == 1 && pressedKeyQcode != myParenID )
471 { 471 {
472 paren = 0; 472 paren = 0;
473 releasedPix = &releasedPlain; 473 releasedPix = &releasedPlain;
474 pressedPix = &pressedPlain; 474 pressedPix = &pressedPlain;
475 bitBlt( &offscreen, 0, 0, releasedPix ); 475 bitBlt( &offscreen, 0, 0, releasedPix );
476 } 476 }
477 477
478 if ( alt && pressedKeyQcode != Qt::Key_Alt ) 478 if ( alt && pressedKeyQcode != Qt::Key_Alt )
479 alt = 0; 479 alt = 0;
480 if ( ctrl && pressedKeyQcode != Qt::Key_Control ) 480 if ( ctrl && pressedKeyQcode != Qt::Key_Control )
481 ctrl = 0; 481 ctrl = 0;
482 482
483 bitBlt( &offscreen, pressedx, pressedy, 483 bitBlt( &offscreen, pressedx, pressedy,
484 releasedPix, pressedx, pressedy, pressedw, pressedh ); 484 releasedPix, pressedx, pressedy, pressedw, pressedh );
485 485
486 if ( isnoncont ) 486 if ( isnoncont )
487 { 487 {
488 isnoncont = false; 488 isnoncont = false;
489 bitBlt( &offscreen, pressed2x, pressed2y, 489 bitBlt( &offscreen, pressed2x, pressed2y,
490 releasedPix, pressed2x, pressed2y, pressed2w, pressed2h ); 490 releasedPix, pressed2x, pressed2y, pressed2w, pressed2h );
491 } 491 }
492 492
493 repaint( false ); 493 repaint( false );
494} 494}
495 495
496void Keyboard::mouseMoveEvent(QMouseEvent *e) 496void Keyboard::mouseMoveEvent(QMouseEvent *e)
497{ 497{
498 if ( !enableMouseTracking ) 498 if ( !enableMouseTracking )
499 return; 499 return;
500 500
501 if ( e->x() < pressedx || e->x() >= pressedx + pressedw ) 501 if ( e->x() < pressedx || e->x() >= pressedx + pressedw )
502 { 502 {
503 pressedKeyUnicode = slideKeyUnicodeH; 503 pressedKeyUnicode = slideKeyUnicodeH;
504 pressedKeyQcode = slideKeyQcodeH; 504 pressedKeyQcode = slideKeyQcodeH;
505 slidePix = slidePixH; 505 slidePix = slidePixH;
506 } 506 }
507 else if ( e->y() < pressedy || e->y() >= pressedy + pressedh ) 507 else if ( e->y() < pressedy || e->y() >= pressedy + pressedh )
508 { 508 {
509 pressedKeyUnicode = slideKeyUnicodeV; 509 pressedKeyUnicode = slideKeyUnicodeV;
510 pressedKeyQcode = slideKeyQcodeV; 510 pressedKeyQcode = slideKeyQcodeV;
511 slidePix = slidePixV; 511 slidePix = slidePixV;
512 } 512 }
513 else 513 else
514 return; 514 return;
515 515
516 enableMouseTracking = false; 516 enableMouseTracking = false;
517 517
518 delayTimer->stop(); 518 delayTimer->stop();
519 rateTimer->stop(); 519 rateTimer->stop();
520 520
521 bitBlt( &offscreen, pressedx, pressedy, 521 bitBlt( &offscreen, pressedx, pressedy,
522 slidePix, pressedx, pressedy, pressedw, pressedh ); 522 slidePix, pressedx, pressedy, pressedw, pressedh );
523 523
524 emit key( 8, Qt::Key_Backspace, pressedMod, true, false ); 524 emit key( 8, Qt::Key_Backspace, pressedMod, true, false );
525 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); 525 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false );
526 delayTimer->start( autorepeatDelaytime, true ); 526 delayTimer->start( autorepeatDelaytime, true );
527 527
528 repaint( false ); 528 repaint( false );
529} 529}
530 530
531void Keyboard::delayTimerDone() 531void Keyboard::delayTimerDone()
532{ 532{
533 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); 533 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true );
534 rateTimer->start( 1000/autorepeatRate, false ); 534 rateTimer->start( 1000/autorepeatRate, false );
535} 535}
536 536
537void Keyboard::rateTimerDone() 537void Keyboard::rateTimerDone()
538{ 538{
539 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); 539 emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true );
540} 540}
541 541
542QSize Keyboard::sizeHint() const 542QSize Keyboard::sizeHint() const
543{ 543{
544 return offscreen.size(); 544 return offscreen.size();
545} 545}
546 546
547void Keyboard::resetState() 547void Keyboard::resetState()
548{ 548{
549 //cout << "resetState()" << endl; 549 //cout << "resetState()" << endl;
550} 550}
551 551
552/* 552/*
553 * 553 *
554 * TODO 554 * TODO
555 * one major problem with this implementation is that you can't move the 555 * one major problem with this implementation is that you can't move the
556 * cursor after inputing korean chars, otherwise it will eat up and replace 556 * cursor after inputing korean chars, otherwise it will eat up and replace
557 * the char before the cursor you move to. fix that 557 * the char before the cursor you move to. fix that
558 * 558 *
559 * make a kor/eng swaping key 559 * make a kor/eng swaping key
560 * 560 *
561 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 561 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
562 * 562 *
563 * how korean input works 563 * how korean input works
564 * 564 *
565 * all following chars means unicode char value and are in hex 565 * all following chars means unicode char value and are in hex
566 * 566 *
567 * ÃÊÀ½ = schar (start char) 567 * �= = schar (start char)
568 * ÁßÀ½ = mchar (middle char) 568 * �= = mchar (middle char)
569 * ³¡À½ = echar (end char) 569 * = = echar (end char)
570 * 570 *
571 * there are 19 schars. unicode position is at 1100 - 1112 571 * there are 19 schars. unicode position is at 1100 - 1112
572 * there are 21 mchars. unicode position is at 1161 - 1175 572 * there are 21 mchars. unicode position is at 1161 - 1175
573 * there are 27 echars. unicode position is at 11a8 - 11c2 573 * there are 27 echars. unicode position is at 11a8 - 11c2
574 * 574 *
575 * the map with everything combined is at ac00 - d7a3 575 * the map with everything combined is at ac00 - d7a3
576 * 576 *
577 * to find a combination of schar + mchar in the map, lookup 577 * to find a combination of schar + mchar in the map, lookup
578 * ((schar - 0x1100) * 587) + ((mchar - 0x1161) * 27) + (echar - 0x11a8) + 0xac00) 578 * ((schar - 0x1100) * 587) + ((mchar - 0x1161) * 27) + (echar - 0x11a8) + 0xac00)
579 * 579 *
580 */ 580 */
581 581
582QChar Keyboard::parseKoreanInput (ushort c) { 582QChar Keyboard::parseKoreanInput (ushort c) {
583 583
584 static ushort schar, mchar, echar; 584 static ushort schar, mchar, echar;
585 585
586 if ((lastKey < 0x1100 || 0x11c2 < lastKey) && (lastKey < 0xac00 || 0xd7a3 < lastKey) 586 if ((lastKey < 0x1100 || 0x11c2 < lastKey) && (lastKey < 0xac00 || 0xd7a3 < lastKey)
587 && !(lastKey == 0 && (shift || paren || ctrl || alt))) { 587 && !(lastKey == 0 && (shift || paren || ctrl || alt))) {
588 588
589 //printf ("reset...\n"); 589 //printf ("reset...\n");
590 schar = 0, mchar = 0, echar = 0; 590 schar = 0, mchar = 0, echar = 0;
591 } 591 }
592 592
593 //printf ("in %x %x %x %x %x\n", schar, mchar, echar, c, lastKey); 593 //printf ("in %x %x %x %x %x\n", schar, mchar, echar, c, lastKey);
594 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input 594 if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input
595 595
596 if (schar == 0 || (schar != 0 && mchar == 0)) { 596 if (schar == 0 || (schar != 0 && mchar == 0)) {
597 schar = c; mchar = 0; echar = 0; 597 schar = c; mchar = 0; echar = 0;
598 return QChar(c); 598 return QChar(c);
599 } 599 }
600 else if (mchar != 0) { 600 else if (mchar != 0) {
601 601
602 if (echar == 0) { 602 if (echar == 0) {
603 603
604 if (!(echar = constoe(c))) { 604 if (!(echar = constoe(c))) {
605 605
606 schar = c; mchar = 0; echar = 0; 606 schar = c; mchar = 0; echar = 0;
607 return QChar(c); 607 return QChar(c);
608 } 608 }
609 609
610 } 610 }
611 else { // must figure out what the echar is 611 else { // must figure out what the echar is
612 612
613 if (echar == 0x11a8) { // ¤¡ 613 if (echar == 0x11a8) { //
614 614
615 if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡ 615 if (c == 0x1100) echar = 0x11a9; // +
616 else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ 616 else if (c == 0x1109) echar = 0x11aa; // +
617 else { 617 else {
618 schar = c; mchar = 0; echar = 0; 618 schar = c; mchar = 0; echar = 0;
619 return QChar(c); 619 return QChar(c);
620 } 620 }
621 621
622 } else if (echar == 0x11ab) { // ¤¤ 622 } else if (echar == 0x11ab) { //
623 623
624 if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸ 624 if (c == 0x110c) echar = 0x11ac; // +
625 else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾ 625 else if (c == 0x1112) echar = 0x11ad; // +
626 else { 626 else {
627 schar = c; mchar = 0; echar = 0; 627 schar = c; mchar = 0; echar = 0;
628 return QChar(c); 628 return QChar(c);
629 } 629 }
630 630
631 } else if (echar == 0x11af) { // ¤© 631 } else if (echar == 0x11af) { //
632 632
633 if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡ 633 if (c == 0x1100) echar = 0x11b0; // +
634 else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤± 634 else if (c == 0x1106) echar = 0x11b1; // +
635 else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤² 635 else if (c == 0x1107) echar = 0x11b2; // +
636 else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ 636 else if (c == 0x1109) echar = 0x11b3; // +
637 else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼ 637 else if (c == 0x1110) echar = 0x11b4; // +
638 else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½ 638 else if (c == 0x1111) echar = 0x11b5; // +
639 else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾ 639 else if (c == 0x1112) echar = 0x11b6; // +
640 else { 640 else {
641 schar = c; mchar = 0; echar = 0; 641 schar = c; mchar = 0; echar = 0;
642 return QChar(c); 642 return QChar(c);
643 } 643 }
644 644
645 } else if (echar == 0x11b8) { // ¤² 645 } else if (echar == 0x11b8) { //
646 646
647 if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ 647 if (c == 0x1109) echar = 0x11b9; // +
648 else { 648 else {
649 schar = c; mchar = 0; echar = 0; 649 schar = c; mchar = 0; echar = 0;
650 return QChar(c); 650 return QChar(c);
651 } 651 }
652 652
653 } else if (echar == 0x11ba) { // ¤µ 653 } else if (echar == 0x11ba) { //
654 654
655 if (c == 0x1109) echar = 0x11bb; // ¤µ + ¤µ 655 if (c == 0x1109) echar = 0x11bb; // +
656 else { 656 else {
657 schar = c; mchar = 0; echar = 0; 657 schar = c; mchar = 0; echar = 0;
658 return QChar(c); 658 return QChar(c);
659 } 659 }
660 660
661 } else { // if any other char, cannot combine chars 661 } else { // if any other char, cannot combine chars
662 662
663 schar = c; mchar = 0; echar = 0; 663 schar = c; mchar = 0; echar = 0;
664 return QChar(c); 664 return QChar(c);
665 } 665 }
666 666
667 lastKey = echar; 667 lastKey = echar;
668 } 668 }
669 } 669 }
670 670
671 } 671 }
672 else if (0x1161 <= c && c <= 0x1175) { // mchar was input 672 else if (0x1161 <= c && c <= 0x1175) { // mchar was input
673 673
674 if (schar != 0 && mchar == 0) { mchar = c; } 674 if (schar != 0 && mchar == 0) { mchar = c; }
675 675
676 else if (schar != 0 && mchar != 0 && echar == 0) { 676 else if (schar != 0 && mchar != 0 && echar == 0) {
677 677
678 switch (mchar) { 678 switch (mchar) {
679 case 0x1169: 679 case 0x1169:
680 if (c == 0x1161) mchar = 0x116a; 680 if (c == 0x1161) mchar = 0x116a;
681 else if (c == 0x1162) mchar = 0x116b; 681 else if (c == 0x1162) mchar = 0x116b;
682 else if (c == 0x1175) mchar = 0x116c; 682 else if (c == 0x1175) mchar = 0x116c;
683 else { 683 else {
684 schar = 0; mchar = 0; echar = 0; 684 schar = 0; mchar = 0; echar = 0;
685 return QChar(c); 685 return QChar(c);
686 } 686 }
687 break; 687 break;
688 case 0x116e: 688 case 0x116e:
689 if (c == 0x1165) mchar = 0x116f; 689 if (c == 0x1165) mchar = 0x116f;
690 else if (c == 0x1166) mchar = 0x1170; 690 else if (c == 0x1166) mchar = 0x1170;
691 else if (c == 0x1175) mchar = 0x1171; 691 else if (c == 0x1175) mchar = 0x1171;
692 else { 692 else {
693 schar = 0; mchar = 0; echar = 0; 693 schar = 0; mchar = 0; echar = 0;
694 return QChar(c); 694 return QChar(c);
695 } 695 }
696 break; 696 break;
697 case 0x1173: 697 case 0x1173:
698 if (c == 0x1175) mchar = 0x1174; 698 if (c == 0x1175) mchar = 0x1174;
699 else { 699 else {
700 schar = 0; mchar = 0; echar = 0; 700 schar = 0; mchar = 0; echar = 0;
701 return QChar(c); 701 return QChar(c);
702 } 702 }
703 break; 703 break;
704 default: 704 default:
705 schar = 0; mchar = 0; echar = 0; 705 schar = 0; mchar = 0; echar = 0;
706 return QChar(c); 706 return QChar(c);
707 } 707 }
708 } 708 }
709 else if (schar != 0 && mchar != 0 && echar != 0) { 709 else if (schar != 0 && mchar != 0 && echar != 0) {
710 710
711 emit key( 8, Qt::Key_Backspace, 0, true, false ); 711 emit key( 8, Qt::Key_Backspace, 0, true, false );
712 712
713 ushort prev = 0; 713 ushort prev = 0;
714 switch (echar) { 714 switch (echar) {
715 /* 715 /*
716 case 0x11a9: 716 case 0x11a9:
717 prev = combineKoreanChars(schar, mchar, 0x11a8); 717 prev = combineKoreanChars(schar, mchar, 0x11a8);
718 schar = 0x1100; 718 schar = 0x1100;
719 break; 719 break;
720 */ 720 */
721 case 0x11aa: 721 case 0x11aa:
722 prev = combineKoreanChars(schar, mchar, 0x11a8); 722 prev = combineKoreanChars(schar, mchar, 0x11a8);
723 schar = 0x1109; 723 schar = 0x1109;
724 break; 724 break;
725 case 0x11ac: 725 case 0x11ac:
726 prev = combineKoreanChars(schar, mchar, 0x11ab); 726 prev = combineKoreanChars(schar, mchar, 0x11ab);
727 schar = 0x110c; 727 schar = 0x110c;
728 break; 728 break;
729 case 0x11ad: 729 case 0x11ad:
730 prev = combineKoreanChars(schar, mchar, 0x11ab); 730 prev = combineKoreanChars(schar, mchar, 0x11ab);
731 schar = 0x1112; 731 schar = 0x1112;
732 break; 732 break;
733 case 0x11b0: 733 case 0x11b0:
734 prev = combineKoreanChars(schar, mchar, 0x11af); 734 prev = combineKoreanChars(schar, mchar, 0x11af);
735 schar = 0x1100; 735 schar = 0x1100;
736 break; 736 break;
737 case 0x11b1: 737 case 0x11b1:
738 prev = combineKoreanChars(schar, mchar, 0x11af); 738 prev = combineKoreanChars(schar, mchar, 0x11af);
739 schar = 0x1106; 739 schar = 0x1106;
740 break; 740 break;
741 case 0x11b2: 741 case 0x11b2:
742 prev = combineKoreanChars(schar, mchar, 0x11af); 742 prev = combineKoreanChars(schar, mchar, 0x11af);
743 schar = 0x1107; 743 schar = 0x1107;
744 break; 744 break;
745 case 0x11b3: 745 case 0x11b3:
746 prev = combineKoreanChars(schar, mchar, 0x11af); 746 prev = combineKoreanChars(schar, mchar, 0x11af);
747 schar = 0x1109; 747 schar = 0x1109;
748 break; 748 break;
749 case 0x11b4: 749 case 0x11b4:
750 prev = combineKoreanChars(schar, mchar, 0x11af); 750 prev = combineKoreanChars(schar, mchar, 0x11af);
751 schar = 0x1110; 751 schar = 0x1110;
752 break; 752 break;
753 case 0x11b9: 753 case 0x11b9:
754 prev = combineKoreanChars(schar, mchar, 0x11b8); 754 prev = combineKoreanChars(schar, mchar, 0x11b8);
755 schar = 0x1109; 755 schar = 0x1109;
756 break; 756 break;
757 /* 757 /*
758 case 0x11bb: 758 case 0x11bb:
759 prev = combineKoreanChars(schar, mchar, 0x11ba); 759 prev = combineKoreanChars(schar, mchar, 0x11ba);
760 schar = 0x1109; 760 schar = 0x1109;
761 break; 761 break;
762 */ 762 */
763 default: 763 default:
764 764
765 if (constoe(echar)) { 765 if (constoe(echar)) {
766 766
767 prev = combineKoreanChars(schar, mchar, 0); 767 prev = combineKoreanChars(schar, mchar, 0);
768 schar = constoe(echar); 768 schar = constoe(echar);
769 } 769 }
770 break; 770 break;
771 } 771 }
772 772
773 emit key( prev, prev, 0, true, false ); 773 emit key( prev, prev, 0, true, false );
774 774
775 mchar = c; echar = 0; 775 mchar = c; echar = 0;
776 776
777 return QChar(combineKoreanChars(schar, mchar, 0)); 777 return QChar(combineKoreanChars(schar, mchar, 0));
778 778
779 } 779 }
780 else { 780 else {
781 schar = 0; mchar = 0; echar = 0; 781 schar = 0; mchar = 0; echar = 0;
782 return QChar(c); 782 return QChar(c);
783 } 783 }
784 784
785 } 785 }
786 else if (c == ' ') return QChar(c); 786 else if (c == ' ') return QChar(c);
787 787
788 788
789 // and now... finally delete previous char, and return new char 789 // and now... finally delete previous char, and return new char
790 emit key( 8, Qt::Key_Backspace, 0, true, false ); 790 emit key( 8, Qt::Key_Backspace, 0, true, false );
791 791
792 //printf ("out %x %x %x %x\n", schar, mchar, echar, c); 792 //printf ("out %x %x %x %x\n", schar, mchar, echar, c);
793 793
794 794
795 return QChar (combineKoreanChars( schar, mchar, echar)); 795 return QChar (combineKoreanChars( schar, mchar, echar));
796 796
797} 797}
798 798
799ushort Keyboard::combineKoreanChars(const ushort s, const ushort m, const ushort e) { 799ushort Keyboard::combineKoreanChars(const ushort s, const ushort m, const ushort e) {
800 800
801 return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00; 801 return ((s - 0x1100) * 588) + ((m - 0x1161) * 28) + (e ? e - 0x11a7 : 0) + 0xac00;
802 802
803} 803}
804 804
805ushort Keyboard::constoe(const ushort c) { 805ushort Keyboard::constoe(const ushort c) {
806 806
807 // converts schars to echars if possible 807 // converts schars to echars if possible
808 808
809 if (0x1100 <= c && c <= 0x1112) { // schar to echar 809 if (0x1100 <= c && c <= 0x1112) { // schar to echar
810 810
811 switch (c) { 811 switch (c) {
812 case 0x1100: return 0x11a8; 812 case 0x1100: return 0x11a8;
813 case 0x1101: return 0x11a9; 813 case 0x1101: return 0x11a9;
814 case 0x1102: return 0x11ab; 814 case 0x1102: return 0x11ab;
815 case 0x1103: return 0x11ae; 815 case 0x1103: return 0x11ae;
816 case 0x1105: return 0x11af; 816 case 0x1105: return 0x11af;
817 case 0x1106: return 0x11b7; 817 case 0x1106: return 0x11b7;
818 case 0x1107: return 0x11b8; 818 case 0x1107: return 0x11b8;
819 case 0x1109: return 0x11ba; 819 case 0x1109: return 0x11ba;
820 case 0x110a: return 0x11bb; 820 case 0x110a: return 0x11bb;
821 case 0x110b: return 0x11bc; 821 case 0x110b: return 0x11bc;
822 case 0x110c: return 0x11bd; 822 case 0x110c: return 0x11bd;
823 case 0x110e: return 0x11be; 823 case 0x110e: return 0x11be;
824 case 0x110f: return 0x11bf; 824 case 0x110f: return 0x11bf;
825 case 0x1110: return 0x11c0; 825 case 0x1110: return 0x11c0;
826 case 0x1111: return 0x11c1; 826 case 0x1111: return 0x11c1;
827 case 0x1112: return 0x11c2; 827 case 0x1112: return 0x11c2;
828 default: return 0; 828 default: return 0;
829 829
830 } 830 }
831 831
832 } else { //echar to schar 832 } else { //echar to schar
833 833
834 switch (c) { 834 switch (c) {
835 case 0x11a8: return 0x1100; 835 case 0x11a8: return 0x1100;
836 case 0x11a9: return 0x1101; 836 case 0x11a9: return 0x1101;
837 case 0x11ab: return 0x1102; 837 case 0x11ab: return 0x1102;
838 case 0x11ae: return 0x1103; 838 case 0x11ae: return 0x1103;
839 case 0x11af: return 0x1105; 839 case 0x11af: return 0x1105;
840 case 0x11b7: return 0x1106; 840 case 0x11b7: return 0x1106;
841 case 0x11b8: return 0x1107; 841 case 0x11b8: return 0x1107;
842 case 0x11ba: return 0x1109; 842 case 0x11ba: return 0x1109;
843 case 0x11bb: return 0x110a; 843 case 0x11bb: return 0x110a;
844 case 0x11bc: return 0x110b; 844 case 0x11bc: return 0x110b;
845 case 0x11bd: return 0x110c; 845 case 0x11bd: return 0x110c;
846 case 0x11be: return 0x110e; 846 case 0x11be: return 0x110e;
847 case 0x11bf: return 0x110f; 847 case 0x11bf: return 0x110f;
848 case 0x11c0: return 0x1110; 848 case 0x11c0: return 0x1110;
849 case 0x11c1: return 0x1111; 849 case 0x11c1: return 0x1111;
850 case 0x11c2: return 0x1112; 850 case 0x11c2: return 0x1112;
851 default: return 0; 851 default: return 0;
852 852
853 } 853 }
854 854
855 } 855 }
856} 856}
diff --git a/inputmethods/kjumpx/kjumpx.pro b/inputmethods/kjumpx/kjumpx.pro
index 09e9bf1..0f708fd 100644
--- a/inputmethods/kjumpx/kjumpx.pro
+++ b/inputmethods/kjumpx/kjumpx.pro
@@ -1,15 +1,15 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = keyboard.h \ 3HEADERS = keyboard.h \
4 keyboardimpl.h 4 keyboardimpl.h
5SOURCES = keyboard.cpp \ 5SOURCES = keyboard.cpp \
6 keyboardimpl.cpp 6 keyboardimpl.cpp
7TARGET = qkjumpx 7TARGET = qkjumpx
8DESTDIR = ../../plugins/inputmethods 8DESTDIR = ../../plugins/inputmethods
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += $(OPIEDIR)/include 10DEPENDPATH += $(OPIEDIR)/include
11LIBS += -lqpe 11LIBS += -lqpe -lopiecore2
12VERSION = 1.0.0 12VERSION = 1.0.0
13 13
14include( $(OPIEDIR)/include.pro ) 14include( $(OPIEDIR)/include.pro )
15target.path = $$prefix/plugins/inputmethods 15target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/kjumpx/opie-kjumpx.control b/inputmethods/kjumpx/opie-kjumpx.control
index 3650812..a9d004e 100644
--- a/inputmethods/kjumpx/opie-kjumpx.control
+++ b/inputmethods/kjumpx/opie-kjumpx.control
@@ -1,11 +1,11 @@
1Package: opie-kjumpx 1Package: opie-kjumpx
2Files: plugins/inputmethods/libqkjumpx.so* pics/kjumpx/* 2Files: plugins/inputmethods/libqkjumpx.so* pics/kjumpx/*
3Priority: optional 3Priority: optional
4Section: opie/inputmethods 4Section: opie/inputmethods
5Maintainer: Jake Richardson <jake@asdfnews.org> 5Maintainer: Jake Richardson <jake@asdfnews.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal, libopiecore2
8License: GPL 8License: GPL
9Description: Koreanized JumpX input method 9Description: Koreanized JumpX input method
10 Keyboard-like input method for the Opie environment. 10 Keyboard-like input method for the Opie environment.
11Version: $QPE_VERSION$EXTRAVERSION 11Version: $QPE_VERSION$EXTRAVERSION
diff --git a/inputmethods/multikey/config.in b/inputmethods/multikey/config.in
index 4eeb326..dd3192b 100644
--- a/inputmethods/multikey/config.in
+++ b/inputmethods/multikey/config.in
@@ -1,4 +1,4 @@
1 config MULTIKEY 1 config MULTIKEY
2 boolean "opie-multikey (OnScreen keyboard for multiple languages)" 2 boolean "opie-multikey (OnScreen keyboard for multiple languages)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && PICKBOARD && LIBQTAUX && LIBOPIE2UI 4 depends ( LIBQPE || LIBQPE-X11 ) && PICKBOARD && LIBQTAUX && LIBOPIE2CORE && LIBOPIE2UI
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index fe5051d..52c498b 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,508 +1,511 @@
1/* 1/*
2 * TODO 2 * TODO
3 * make a font selection thing (size too) 3 * make a font selection thing (size too)
4 * make a keymap editor 4 * make a keymap editor
5 * make keys translucent 5 * make keys translucent
6 * make vertical keys possible 6 * make vertical keys possible
7 * 7 *
8 * 8 *
9 */ 9 */
10 10
11#include <opie2/ofiledialog.h>
12#include <opie2/qcolordialog.h>
13#include <opie2/oresource.h>
14
11#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 16#include <qpe/config.h>
13#include <qpe/resource.h>
14 17
15#include <qlayout.h> 18#include <qlayout.h>
16#include <qwidget.h> 19#include <qwidget.h>
17#include <qdialog.h> 20#include <qdialog.h>
18#include <qtabwidget.h> 21#include <qtabwidget.h>
19#include <qvbox.h> 22#include <qvbox.h>
20#include <qgrid.h> 23#include <qgrid.h>
21#include <qgroupbox.h> 24#include <qgroupbox.h>
22#include <qlabel.h> 25#include <qlabel.h>
23#include <qcheckbox.h> 26#include <qcheckbox.h>
24#include <qsizepolicy.h> 27#include <qsizepolicy.h>
25#include <qpushbutton.h> 28#include <qpushbutton.h>
26#include <qlistbox.h> 29#include <qlistbox.h>
27#include <qstringlist.h> 30#include <qstringlist.h>
28#include <qtoolbutton.h> 31#include <qtoolbutton.h>
29#include <opie2/ofiledialog.h>
30#include <opie2/qcolordialog.h>
31#include <qdir.h> 32#include <qdir.h>
32#include <qfileinfo.h> 33#include <qfileinfo.h>
33#include "configdlg.h" 34#include "configdlg.h"
34#include "keyboard.h" 35#include "keyboard.h"
35 36
36using namespace Opie; 37using namespace Opie;
37using namespace Opie::Ui; 38using namespace Opie::Ui;
38// ConfigDlg::ConfigDlg() {{{1 39// ConfigDlg::ConfigDlg() {{{1
39ConfigDlg::ConfigDlg () : QDialog () 40ConfigDlg::ConfigDlg () : QDialog ()
40{ 41{
41 setCaption( tr("Multikey Configuration") ); 42 setCaption( tr("Multikey Configuration") );
42 Config config ("multikey"); 43 Config config ("multikey");
43 config.setGroup("keymaps"); 44 config.setGroup("keymaps");
44 QString current_map = config.readEntry("current", 0); 45 QString current_map = config.readEntry("current", 0);
45 46
46 /* 47 /*
47 * 'general config' tab 48 * 'general config' tab
48 */ 49 */
49 50
50 QVBoxLayout *base_lay = new QVBoxLayout(this); 51 QVBoxLayout *base_lay = new QVBoxLayout(this);
51 52
52 QTabWidget *tabs = new QTabWidget(this, "tabs"); 53 QTabWidget *tabs = new QTabWidget(this, "tabs");
53 54
54 QWidget *gen_box = new QWidget(tabs, "gen_tab"); 55 QWidget *gen_box = new QWidget(tabs, "gen_tab");
55 QVBoxLayout *gen_lay = new QVBoxLayout(gen_box); 56 QVBoxLayout *gen_lay = new QVBoxLayout(gen_box);
56 gen_lay->setMargin(3); 57 gen_lay->setMargin(3);
57 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); 58 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box);
58 59
59 QHBox *hbox1 = new QHBox(map_group); 60 QHBox *hbox1 = new QHBox(map_group);
60 keymaps = new QListBox(hbox1); 61 keymaps = new QListBox(hbox1);
61 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 62 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
62 QVBox *vbox1 = new QVBox(hbox1); 63 QVBox *vbox1 = new QVBox(hbox1);
63 64
64 QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up")); 65 QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up"));
65 tb1->setPixmap(Resource::loadPixmap("up")); 66 tb1->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
67 tb1->setPixmap(Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon));
66 tb1->setAutoRaise(TRUE); 68 tb1->setAutoRaise(TRUE);
67 tb1->setFocusPolicy(QWidget::NoFocus); 69 tb1->setFocusPolicy(QWidget::NoFocus);
68 tb1->setToggleButton(FALSE); 70 tb1->setToggleButton(FALSE);
69 connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); 71 connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp()));
70 72
71 QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down")); 73 QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down"));
72 tb2->setPixmap(Resource::loadPixmap("down")); 74 tb2->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
75 tb2->setPixmap(Opie::Core::OResource::loadPixmap("down", Opie::Core::OResource::SmallIcon));
73 tb2->setAutoRaise(TRUE); 76 tb2->setAutoRaise(TRUE);
74 tb2->setFocusPolicy(QWidget::NoFocus); 77 tb2->setFocusPolicy(QWidget::NoFocus);
75 tb2->setToggleButton(FALSE); 78 tb2->setToggleButton(FALSE);
76 connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); 79 connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown()));
77 80
78 QString cur(tr("Current Language")); 81 QString cur(tr("Current Language"));
79 keymaps->insertItem(cur); 82 keymaps->insertItem(cur);
80 keymaps->setSelected(0, true); 83 keymaps->setSelected(0, true);
81 84
82 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); 85 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap");
83 default_maps = map_dir.entryList(); // so i can access it in other places 86 default_maps = map_dir.entryList(); // so i can access it in other places
84 custom_maps = config.readListEntry("maps", QChar('|')); 87 custom_maps = config.readListEntry("maps", QChar('|'));
85 sw_maps = ConfigDlg::loadSw(); 88 sw_maps = ConfigDlg::loadSw();
86 89
87 QStringList sw_copy(sw_maps); 90 QStringList sw_copy(sw_maps);
88 for (uint i = 0; i < sw_copy.count(); i++) { 91 for (uint i = 0; i < sw_copy.count(); i++) {
89 92
90 QString keymap_map; 93 QString keymap_map;
91 if (sw_copy[i][0] != '/') { /* share/multikey */ 94 if (sw_copy[i][0] != '/') { /* share/multikey */
92 95
93 keymap_map = map_dir.absPath() + "/" + sw_copy[i]; 96 keymap_map = map_dir.absPath() + "/" + sw_copy[i];
94 } else { 97 } else {
95 98
96 if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false) 99 if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false)
97 || !QFile::exists(sw_copy[i])) { 100 || !QFile::exists(sw_copy[i])) {
98 101
99 custom_maps.remove(sw_copy[i]); 102 custom_maps.remove(sw_copy[i]);
100 sw_maps.remove(sw_copy[i]); 103 sw_maps.remove(sw_copy[i]);
101 104
102 // remove it from the list too 105 // remove it from the list too
103 config.writeEntry("maps", custom_maps.join("|")); 106 config.writeEntry("maps", custom_maps.join("|"));
104 107
105 continue; 108 continue;
106 } 109 }
107 keymap_map = sw_copy[i]; 110 keymap_map = sw_copy[i];
108 } 111 }
109 112
110 QFile map(keymap_map); 113 QFile map(keymap_map);
111 if (map.open(IO_ReadOnly)) { 114 if (map.open(IO_ReadOnly)) {
112 115
113 QString line; bool found = 0; 116 QString line; bool found = 0;
114 117
115 map.readLine(line, 1024); 118 map.readLine(line, 1024);
116 while (!map.atEnd()) { 119 while (!map.atEnd()) {
117 120
118 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { 121 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) {
119 122
120 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 123 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
121 found = 1; 124 found = 1;
122 break; 125 break;
123 } 126 }
124 map.readLine(line, 1024); 127 map.readLine(line, 1024);
125 } 128 }
126 if (!found) 129 if (!found)
127 keymaps->insertItem(keymap_map); 130 keymaps->insertItem(keymap_map);
128 131
129 map.close(); 132 map.close();
130 } 133 }
131 134
132 if (keymap_map == current_map) { 135 if (keymap_map == current_map) {
133 keymaps->setSelected(i + 1, true); 136 keymaps->setSelected(i + 1, true);
134 } 137 }
135 } 138 }
136 139
137 // have to "+1" because the "current language" listItem... remember? 140 // have to "+1" because the "current language" listItem... remember?
138 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); 141 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int)));
139 142
140 QGrid *add_remove_grid = new QGrid(2, map_group); 143 QGrid *add_remove_grid = new QGrid(2, map_group);
141 add_remove_grid->setMargin(3); 144 add_remove_grid->setMargin(3);
142 add_remove_grid->setSpacing(3); 145 add_remove_grid->setSpacing(3);
143 146
144 add_button = new QPushButton(tr("Add"), add_remove_grid); 147 add_button = new QPushButton(tr("Add"), add_remove_grid);
145 add_button->setFlat(TRUE); 148 add_button->setFlat(TRUE);
146 connect(add_button, SIGNAL(clicked()), SLOT(addMap())); 149 connect(add_button, SIGNAL(clicked()), SLOT(addMap()));
147 150
148 remove_button = new QPushButton(tr("Remove"), add_remove_grid); 151 remove_button = new QPushButton(tr("Remove"), add_remove_grid);
149 remove_button->setFlat(TRUE); 152 remove_button->setFlat(TRUE);
150 if (keymaps->currentItem() == 0 || default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end()) 153 if (keymaps->currentItem() == 0 || default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end())
151 remove_button->setDisabled(true); 154 remove_button->setDisabled(true);
152 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); 155 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap()));
153 156
154 gen_lay->addWidget(map_group); 157 gen_lay->addWidget(map_group);
155 158
156 // make a box that will contain the buttons on the bottom 159 // make a box that will contain the buttons on the bottom
157 QGrid *other_grid = new QGrid(2, gen_box); 160 QGrid *other_grid = new QGrid(2, gen_box);
158 pick_button = new QCheckBox(tr("Pickboard"), other_grid); 161 pick_button = new QCheckBox(tr("Pickboard"), other_grid);
159 162
160 config.setGroup ("general"); 163 config.setGroup ("general");
161 bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed 164 bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed
162 if (pick_open) { 165 if (pick_open) {
163 166
164 pick_button->setChecked(true); 167 pick_button->setChecked(true);
165 } 168 }
166 169
167 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); 170 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid);
168 bool repeat_on = config.readBoolEntry ("useRepeat", TRUE); 171 bool repeat_on = config.readBoolEntry ("useRepeat", TRUE);
169 172
170 if (repeat_on) { 173 if (repeat_on) {
171 174
172 repeat_button->setChecked(true); 175 repeat_button->setChecked(true);
173 } 176 }
174 177
175 gen_lay->addWidget(other_grid); 178 gen_lay->addWidget(other_grid);
176 tabs->addTab(gen_box, tr("General Settings")); 179 tabs->addTab(gen_box, tr("General Settings"));
177 180
178 /* 181 /*
179 * 'color' tab 182 * 'color' tab
180 */ 183 */
181 184
182 QWidget *color_box = new QWidget(tabs, "color_tab"); 185 QWidget *color_box = new QWidget(tabs, "color_tab");
183 186
184 QGridLayout *color_lay = new QGridLayout(color_box); 187 QGridLayout *color_lay = new QGridLayout(color_box);
185 QGrid *color_grid = new QGrid(2, color_box); 188 QGrid *color_grid = new QGrid(2, color_box);
186 color_lay->setAlignment(Qt::AlignTop); 189 color_lay->setAlignment(Qt::AlignTop);
187 color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 190 color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
188 color_grid->layout()->setAlignment(Qt::AlignTop); 191 color_grid->layout()->setAlignment(Qt::AlignTop);
189 color_grid->setMargin(3); 192 color_grid->setMargin(3);
190 color_grid->setSpacing(3); 193 color_grid->setSpacing(3);
191 194
192 QLabel *label; 195 QLabel *label;
193 QStringList color; 196 QStringList color;
194 config.setGroup("colors"); 197 config.setGroup("colors");
195 198
196 label = new QLabel(tr("Key Color"), color_grid); 199 label = new QLabel(tr("Key Color"), color_grid);
197 keycolor_button = new QPushButton(color_grid); 200 keycolor_button = new QPushButton(color_grid);
198 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); 201 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked()));
199 keycolor_button->setFlat(TRUE); 202 keycolor_button->setFlat(TRUE);
200 color = config.readListEntry("keycolor", QChar(',')); 203 color = config.readListEntry("keycolor", QChar(','));
201 /* 204 /*
202 * hopefully not required 205 * hopefully not required
203 206
204 if (color.isEmpty()) { 207 if (color.isEmpty()) {
205 color = QStringList::split(",", "240,240,240"); 208 color = QStringList::split(",", "240,240,240");
206 config.writeEntry("keycolor", color.join(",")); 209 config.writeEntry("keycolor", color.join(","));
207 210
208 } 211 }
209 */ 212 */
210 keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); 213 keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())));
211 214
212 215
213 label = new QLabel(tr("Key Pressed Color"), color_grid); 216 label = new QLabel(tr("Key Pressed Color"), color_grid);
214 keycolor_pressed_button = new QPushButton(color_grid); 217 keycolor_pressed_button = new QPushButton(color_grid);
215 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); 218 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked()));
216 keycolor_pressed_button->setFlat(TRUE); 219 keycolor_pressed_button->setFlat(TRUE);
217 color = config.readListEntry("keycolor_pressed", QChar(',')); 220 color = config.readListEntry("keycolor_pressed", QChar(','));
218 keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 221 keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
219 222
220 label = new QLabel(tr("Line Color"), color_grid); 223 label = new QLabel(tr("Line Color"), color_grid);
221 keycolor_lines_button = new QPushButton(color_grid); 224 keycolor_lines_button = new QPushButton(color_grid);
222 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); 225 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked()));
223 keycolor_lines_button->setFlat(TRUE); 226 keycolor_lines_button->setFlat(TRUE);
224 color = config.readListEntry("keycolor_lines", QChar(',')); 227 color = config.readListEntry("keycolor_lines", QChar(','));
225 keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 228 keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
226 229
227 230
228 label = new QLabel(tr("Text Color"), color_grid); 231 label = new QLabel(tr("Text Color"), color_grid);
229 textcolor_button = new QPushButton(color_grid); 232 textcolor_button = new QPushButton(color_grid);
230 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); 233 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked()));
231 textcolor_button->setFlat(TRUE); 234 textcolor_button->setFlat(TRUE);
232 color = config.readListEntry("textcolor", QChar(',')); 235 color = config.readListEntry("textcolor", QChar(','));
233 textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 236 textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
234 237
235 label = new QLabel("", color_grid); // a spacer so the above buttons dont expand 238 label = new QLabel("", color_grid); // a spacer so the above buttons dont expand
236 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 239 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
237 /* FIXME: hacked spacer height */ 240 /* FIXME: hacked spacer height */
238 QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); 241 QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum);
239 242
240 color_lay->addWidget(color_grid, 0, 0); 243 color_lay->addWidget(color_grid, 0, 0);
241 color_lay->addItem(spacer); 244 color_lay->addItem(spacer);
242 245
243 tabs->addTab(color_box, tr("Colors")); 246 tabs->addTab(color_box, tr("Colors"));
244 base_lay->addWidget(tabs); 247 base_lay->addWidget(tabs);
245} 248}
246 249
247QStringList ConfigDlg::loadSw() 250QStringList ConfigDlg::loadSw()
248{ 251{
249 Config *config = new Config("multikey"); 252 Config *config = new Config("multikey");
250 config->setGroup("keymaps"); 253 config->setGroup("keymaps");
251 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); 254 QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap");
252 QStringList d_maps = map_dir.entryList(); // so i can access it in other places 255 QStringList d_maps = map_dir.entryList(); // so i can access it in other places
253 QStringList c_maps = config->readListEntry("maps", QChar('|')); 256 QStringList c_maps = config->readListEntry("maps", QChar('|'));
254 QStringList s_maps = config->readListEntry("sw", QChar('|')); 257 QStringList s_maps = config->readListEntry("sw", QChar('|'));
255 delete config; 258 delete config;
256 259
257 if (!s_maps.count()) 260 if (!s_maps.count())
258 { 261 {
259 s_maps = d_maps+c_maps; 262 s_maps = d_maps+c_maps;
260 } 263 }
261 else 264 else
262 { 265 {
263 /* Clear non existents entries */ 266 /* Clear non existents entries */
264 QStringList s_copy(s_maps); 267 QStringList s_copy(s_maps);
265 for (uint i = 0; i < s_copy.count(); ++i) { 268 for (uint i = 0; i < s_copy.count(); ++i) {
266 if (d_maps.find(s_copy[i]) == d_maps.end() 269 if (d_maps.find(s_copy[i]) == d_maps.end()
267 && c_maps.find(s_copy[i]) == c_maps.end()) { 270 && c_maps.find(s_copy[i]) == c_maps.end()) {
268 s_maps.remove(s_copy[i]); 271 s_maps.remove(s_copy[i]);
269 } 272 }
270 } 273 }
271 /* Update sw_maps from default_maps */ 274 /* Update sw_maps from default_maps */
272 for (uint i = 0; i < d_maps.count(); ++i) { 275 for (uint i = 0; i < d_maps.count(); ++i) {
273 if (s_maps.find(d_maps[i]) == s_maps.end()) { 276 if (s_maps.find(d_maps[i]) == s_maps.end()) {
274 s_maps.append(d_maps[i]); 277 s_maps.append(d_maps[i]);
275 } 278 }
276 } 279 }
277 /* Update sw_maps from custom_maps */ 280 /* Update sw_maps from custom_maps */
278 for (uint i = 0; i < c_maps.count(); ++i) { 281 for (uint i = 0; i < c_maps.count(); ++i) {
279 if (s_maps.find(c_maps[i]) == s_maps.end()) { 282 if (s_maps.find(c_maps[i]) == s_maps.end()) {
280 s_maps.append(c_maps[i]); 283 s_maps.append(c_maps[i]);
281 } 284 }
282 } 285 }
283 } 286 }
284 287
285 return s_maps; 288 return s_maps;
286} 289}
287 290
288void ConfigDlg::accept() 291void ConfigDlg::accept()
289{ 292{
290 /* Writing all stuffs to config */ 293 /* Writing all stuffs to config */
291 Config *config = new Config("multikey"); 294 Config *config = new Config("multikey");
292 config->setGroup("general"); 295 config->setGroup("general");
293 config->writeEntry("usePickboard", pick_button->isChecked()); // default closed 296 config->writeEntry("usePickboard", pick_button->isChecked()); // default closed
294 config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed 297 config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed
295 298
296 config->setGroup("keymaps"); 299 config->setGroup("keymaps");
297 config->writeEntry("sw", sw_maps, QChar('|')); 300 config->writeEntry("sw", sw_maps, QChar('|'));
298 config->writeEntry("maps", custom_maps, QChar('|')); 301 config->writeEntry("maps", custom_maps, QChar('|'));
299 delete config; 302 delete config;
300 303
301 int index = keymaps->currentItem(); 304 int index = keymaps->currentItem();
302 if (index == 0) { 305 if (index == 0) {
303 306
304 remove_button->setDisabled(true); 307 remove_button->setDisabled(true);
305 emit setMapToDefault(); 308 emit setMapToDefault();
306 } 309 }
307 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { 310 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) {
308 311
309 remove_button->setDisabled(true); 312 remove_button->setDisabled(true);
310 emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]); 313 emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]);
311 314
312 } else { 315 } else {
313 316
314 remove_button->setEnabled(true); 317 remove_button->setEnabled(true);
315 emit setMapToFile(sw_maps[index - 1]); 318 emit setMapToFile(sw_maps[index - 1]);
316 } 319 }
317 320
318 emit pickboardToggled(pick_button->isChecked()); 321 emit pickboardToggled(pick_button->isChecked());
319 emit repeatToggled(repeat_button->isChecked()); 322 emit repeatToggled(repeat_button->isChecked());
320 emit reloadSw(); 323 emit reloadSw();
321 324
322 QDialog::accept(); 325 QDialog::accept();
323 emit configDlgClosed(); 326 emit configDlgClosed();
324} 327}
325 328
326void ConfigDlg::moveSelectedUp() 329void ConfigDlg::moveSelectedUp()
327{ 330{
328 int i = keymaps->currentItem(); 331 int i = keymaps->currentItem();
329 /* Ignore Current Language */ 332 /* Ignore Current Language */
330 if (i > 1) { 333 if (i > 1) {
331 QString t = sw_maps[i-1]; 334 QString t = sw_maps[i-1];
332 sw_maps[i-1] = sw_maps[i-2]; 335 sw_maps[i-1] = sw_maps[i-2];
333 sw_maps[i-2] = t; 336 sw_maps[i-2] = t;
334 337
335 QString item = keymaps->currentText(); 338 QString item = keymaps->currentText();
336 keymaps->removeItem(i); 339 keymaps->removeItem(i);
337 keymaps->insertItem(item, i-1); 340 keymaps->insertItem(item, i-1);
338 keymaps->setCurrentItem(i-1); 341 keymaps->setCurrentItem(i-1);
339 } 342 }
340} 343}
341 344
342void ConfigDlg::moveSelectedDown() 345void ConfigDlg::moveSelectedDown()
343{ 346{
344 int i = keymaps->currentItem(); 347 int i = keymaps->currentItem();
345 /* Ignore Current Language */ 348 /* Ignore Current Language */
346 if (i > 0 && i < (int)keymaps->count() - 1) { 349 if (i > 0 && i < (int)keymaps->count() - 1) {
347 QString t = sw_maps[i-1]; 350 QString t = sw_maps[i-1];
348 sw_maps[i-1] = sw_maps[i]; 351 sw_maps[i-1] = sw_maps[i];
349 sw_maps[i] = t; 352 sw_maps[i] = t;
350 353
351 QString item = keymaps->currentText(); 354 QString item = keymaps->currentText();
352 keymaps->removeItem(i); 355 keymaps->removeItem(i);
353 keymaps->insertItem(item, i+1); 356 keymaps->insertItem(item, i+1);
354 keymaps->setCurrentItem(i+1); 357 keymaps->setCurrentItem(i+1);
355 } 358 }
356} 359}
357 360
358void ConfigDlg::closeEvent(QCloseEvent *) { 361void ConfigDlg::closeEvent(QCloseEvent *) {
359 362
360 // tell the parent it was closed, so delete me 363 // tell the parent it was closed, so delete me
361 emit configDlgClosed(); 364 emit configDlgClosed();
362} 365}
363 366
364void ConfigDlg::setMap(int index) { 367void ConfigDlg::setMap(int index) {
365 368
366 if (index == 0 || default_maps.find(sw_maps[index-1]) != default_maps.end()) { 369 if (index == 0 || default_maps.find(sw_maps[index-1]) != default_maps.end()) {
367 remove_button->setDisabled(true); 370 remove_button->setDisabled(true);
368 } else { 371 } else {
369 remove_button->setEnabled(true); 372 remove_button->setEnabled(true);
370 } 373 }
371} 374}
372 375
373// ConfigDlg::addMap() {{{1 376// ConfigDlg::addMap() {{{1
374void ConfigDlg::addMap() { 377void ConfigDlg::addMap() {
375 378
376 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); 379 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath());
377 380
378 if (map.isNull()) return; 381 if (map.isNull()) return;
379 382
380 Config config ("multikey"); 383 Config config ("multikey");
381 config.setGroup("keymaps"); 384 config.setGroup("keymaps");
382 QStringList maps = config.readListEntry("maps", QChar('|')); 385 QStringList maps = config.readListEntry("maps", QChar('|'));
383 maps.append(map); 386 maps.append(map);
384 custom_maps.append(map); 387 custom_maps.append(map);
385 if (sw_maps.find(map) == sw_maps.end()) 388 if (sw_maps.find(map) == sw_maps.end())
386 sw_maps.append(map); 389 sw_maps.append(map);
387 390
388 QFile map_file (map); 391 QFile map_file (map);
389 if (map_file.open(IO_ReadOnly)) { 392 if (map_file.open(IO_ReadOnly)) {
390 393
391 QString line; bool found = 0; 394 QString line; bool found = 0;
392 395
393 map_file.readLine(line, 1024); 396 map_file.readLine(line, 1024);
394 while (!map_file.atEnd()) { 397 while (!map_file.atEnd()) {
395 398
396 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { 399 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) {
397 400
398 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 401 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
399 found = 1; 402 found = 1;
400 break; 403 break;
401 } 404 }
402 map_file.readLine(line, 1024); 405 map_file.readLine(line, 1024);
403 } 406 }
404 if (!found) keymaps->insertItem(map); 407 if (!found) keymaps->insertItem(map);
405 408
406 map_file.close(); 409 map_file.close();
407 } 410 }
408 411
409 keymaps->setSelected(keymaps->count() - 1, true); 412 keymaps->setSelected(keymaps->count() - 1, true);
410} 413}
411 414
412// ConfigDlg::removeMap() {{{1 415// ConfigDlg::removeMap() {{{1
413void ConfigDlg::removeMap() { 416void ConfigDlg::removeMap() {
414 417
415 // move selection up one 418 // move selection up one
416 keymaps->setSelected(keymaps->currentItem() - 1, true); 419 keymaps->setSelected(keymaps->currentItem() - 1, true);
417 // delete the next selected item cus you just moved it up 420 // delete the next selected item cus you just moved it up
418 keymaps->removeItem(keymaps->currentItem() + 1); 421 keymaps->removeItem(keymaps->currentItem() + 1);
419 422
420 custom_maps.remove(sw_maps[keymaps->currentItem()]); 423 custom_maps.remove(sw_maps[keymaps->currentItem()]);
421 sw_maps.remove(sw_maps.at(keymaps->currentItem())); 424 sw_maps.remove(sw_maps.at(keymaps->currentItem()));
422} 425}
423 426
424/* ConfigDlg::slots for the color buttons {{{1 427/* ConfigDlg::slots for the color buttons {{{1
425 * 428 *
426 * these four slots are almost the same, except for the names. i was thinking 429 * these four slots are almost the same, except for the names. i was thinking
427 * of making a map with pointers to the buttons and names of the configEntry 430 * of making a map with pointers to the buttons and names of the configEntry
428 * so it could be one slot, but then there would be no way of telling which 431 * so it could be one slot, but then there would be no way of telling which
429 * of the buttons was clicked if they all connect to the same slot. 432 * of the buttons was clicked if they all connect to the same slot.
430 * 433 *
431 */ 434 */
432 435
433void ConfigDlg::keyColorClicked() { 436void ConfigDlg::keyColorClicked() {
434 437
435 Config config ("multikey"); 438 Config config ("multikey");
436 config.setGroup ("colors"); 439 config.setGroup ("colors");
437 440
438 QStringList color = config.readListEntry("keycolor", QChar(',')); 441 QStringList color = config.readListEntry("keycolor", QChar(','));
439 442
440 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 443 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
441 444
442 color[0].setNum(newcolor.red()); 445 color[0].setNum(newcolor.red());
443 color[1].setNum(newcolor.green()); 446 color[1].setNum(newcolor.green());
444 color[2].setNum(newcolor.blue()); 447 color[2].setNum(newcolor.blue());
445 448
446 config.writeEntry("keycolor", color, QChar(',')); 449 config.writeEntry("keycolor", color, QChar(','));
447 config.write(); 450 config.write();
448 451
449 keycolor_button->setPalette(QPalette(newcolor)); 452 keycolor_button->setPalette(QPalette(newcolor));
450 emit reloadKeyboard(); 453 emit reloadKeyboard();
451} 454}
452void ConfigDlg::keyColorPressedClicked() { 455void ConfigDlg::keyColorPressedClicked() {
453 456
454 Config config ("multikey"); 457 Config config ("multikey");
455 config.setGroup ("colors"); 458 config.setGroup ("colors");
456 459
457 QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); 460 QStringList color = config.readListEntry("keycolor_pressed", QChar(','));
458 461
459 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 462 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
460 463
461 color[0].setNum(newcolor.red()); 464 color[0].setNum(newcolor.red());
462 color[1].setNum(newcolor.green()); 465 color[1].setNum(newcolor.green());
463 color[2].setNum(newcolor.blue()); 466 color[2].setNum(newcolor.blue());
464 467
465 config.writeEntry("keycolor_pressed", color, QChar(',')); 468 config.writeEntry("keycolor_pressed", color, QChar(','));
466 config.write(); 469 config.write();
467 470
468 keycolor_pressed_button->setPalette(QPalette(newcolor)); 471 keycolor_pressed_button->setPalette(QPalette(newcolor));
469 emit reloadKeyboard(); 472 emit reloadKeyboard();
470} 473}
471void ConfigDlg::keyColorLinesClicked() { 474void ConfigDlg::keyColorLinesClicked() {
472 475
473 Config config ("multikey"); 476 Config config ("multikey");
474 config.setGroup ("colors"); 477 config.setGroup ("colors");
475 478
476 QStringList color = config.readListEntry("keycolor_lines", QChar(',')); 479 QStringList color = config.readListEntry("keycolor_lines", QChar(','));
477 480
478 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 481 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
479 482
480 color[0].setNum(newcolor.red()); 483 color[0].setNum(newcolor.red());
481 color[1].setNum(newcolor.green()); 484 color[1].setNum(newcolor.green());
482 color[2].setNum(newcolor.blue()); 485 color[2].setNum(newcolor.blue());
483 486
484 config.writeEntry("keycolor_lines", color, QChar(',')); 487 config.writeEntry("keycolor_lines", color, QChar(','));
485 config.write(); 488 config.write();
486 489
487 keycolor_lines_button->setPalette(QPalette(newcolor)); 490 keycolor_lines_button->setPalette(QPalette(newcolor));
488 emit reloadKeyboard(); 491 emit reloadKeyboard();
489} 492}
490void ConfigDlg::textColorClicked() { 493void ConfigDlg::textColorClicked() {
491 494
492 Config config ("multikey"); 495 Config config ("multikey");
493 config.setGroup ("colors"); 496 config.setGroup ("colors");
494 497
495 QStringList color = config.readListEntry("textcolor", QChar(',')); 498 QStringList color = config.readListEntry("textcolor", QChar(','));
496 499
497 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 500 QColor newcolor = QColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
498 501
499 color[0].setNum(newcolor.red()); 502 color[0].setNum(newcolor.red());
500 color[1].setNum(newcolor.green()); 503 color[1].setNum(newcolor.green());
501 color[2].setNum(newcolor.blue()); 504 color[2].setNum(newcolor.blue());
502 505
503 config.writeEntry("textcolor", color, QChar(',')); 506 config.writeEntry("textcolor", color, QChar(','));
504 config.write(); 507 config.write();
505 508
506 textcolor_button->setPalette(QPalette(newcolor)); 509 textcolor_button->setPalette(QPalette(newcolor));
507 emit reloadKeyboard(); 510 emit reloadKeyboard();
508} 511}
diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro
index 3fd621f..4ad1923 100644
--- a/inputmethods/multikey/multikey.pro
+++ b/inputmethods/multikey/multikey.pro
@@ -1,18 +1,18 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt plugin warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= keyboard.h \ 3 HEADERS= keyboard.h \
4 configdlg.h \ 4 configdlg.h \
5 keyboardimpl.h 5 keyboardimpl.h
6 SOURCES= keyboard.cpp \ 6 SOURCES= keyboard.cpp \
7 configdlg.cpp \ 7 configdlg.cpp \
8 keyboardimpl.cpp 8 keyboardimpl.cpp
9 TARGET = qmultikey 9 TARGET = qmultikey
10 DESTDIR = $(OPIEDIR)/plugins/inputmethods 10 DESTDIR = $(OPIEDIR)/plugins/inputmethods
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += ../../launcher 12DEPENDPATH += ../../launcher
13LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopieui2 13LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard -lqtaux2 -lopiecore2 -lopieui2
14 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods 14 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods
15 VERSION = 1.0.0 15 VERSION = 1.0.0
16 16
17include( $(OPIEDIR)/include.pro ) 17include( $(OPIEDIR)/include.pro )
18target.path = $$prefix/plugins/inputmethods 18target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/multikey/opie-multikey.control b/inputmethods/multikey/opie-multikey.control
index 5a5ce77..fc7d56c 100644
--- a/inputmethods/multikey/opie-multikey.control
+++ b/inputmethods/multikey/opie-multikey.control
@@ -1,10 +1,10 @@
1Package: opie-multikey 1Package: opie-multikey
2Files: plugins/inputmethods/libqmultikey.so* share/multikey/* 2Files: plugins/inputmethods/libqmultikey.so* share/multikey/*
3Priority: optional 3Priority: optional
4Section: opie/inputmethods 4Section: opie/inputmethods
5Maintainer: Jake Richardson (jake@asdfnews.org) 5Maintainer: Jake Richardson (jake@asdfnews.org)
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, opie-pickboard, libqtaux2 7Depends: task-opie-minimal, opie-pickboard, libqtaux2, libopiecore2, libopieui2
8Description: Multiple language keyboard 8Description: Multiple language keyboard
9 Keyboard for inputing multiple languages in the Opie environment. 9 Keyboard for inputing multiple languages in the Opie environment.
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION