author | brad <brad> | 2004-04-05 13:31:49 (UTC) |
---|---|---|
committer | brad <brad> | 2004-04-05 13:31:49 (UTC) |
commit | d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b (patch) (unidiff) | |
tree | f313bde2c45d1a90ef5949f77c48943b57a312cd /inputmethods/handwriting/qimpeninput.cpp | |
parent | 743adf3ed3032feb15e71002613a4643d059aa09 (diff) | |
download | opie-d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b.zip opie-d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b.tar.gz opie-d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b.tar.bz2 |
qDebug -> odebug
Diffstat (limited to 'inputmethods/handwriting/qimpeninput.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/handwriting/qimpeninput.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp index d073cdf..6ea1bb4 100644 --- a/inputmethods/handwriting/qimpeninput.cpp +++ b/inputmethods/handwriting/qimpeninput.cpp | |||
@@ -1,134 +1,135 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "qimpenwidget.h" | 21 | #include "qimpenwidget.h" |
22 | #include "qimpensetup.h" | 22 | #include "qimpensetup.h" |
23 | #include "qimpeninput.h" | 23 | #include "qimpeninput.h" |
24 | #include "qimpencombining.h" | 24 | #include "qimpencombining.h" |
25 | #include "qimpenwordpick.h" | 25 | #include "qimpenwordpick.h" |
26 | #include "qimpenmatch.h" | 26 | #include "qimpenmatch.h" |
27 | #include "qimpenhelp.h" | 27 | #include "qimpenhelp.h" |
28 | 28 | ||
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/qdawg.h> | 30 | #include <qpe/qdawg.h> |
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/global.h> | 32 | #include <qpe/global.h> |
33 | 33 | ||
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <opie2/odebug.h> | ||
39 | 40 | ||
40 | #include <limits.h> | 41 | #include <limits.h> |
41 | 42 | ||
42 | // We'll use little pixmaps for the buttons to save screen space. | 43 | // We'll use little pixmaps for the buttons to save screen space. |
43 | 44 | ||
44 | /* XPM */ | 45 | /* XPM */ |
45 | static const char * const pen_xpm[] = { | 46 | static const char * const pen_xpm[] = { |
46 | "12 12 4 1", | 47 | "12 12 4 1", |
47 | " c None", | 48 | " c None", |
48 | ".c #000000", | 49 | ".c #000000", |
49 | "+c #FFFFFF", | 50 | "+c #FFFFFF", |
50 | "@c #808080", | 51 | "@c #808080", |
51 | " . ", | 52 | " . ", |
52 | " .+. ", | 53 | " .+. ", |
53 | " ..@@.", | 54 | " ..@@.", |
54 | " .+@.. ", | 55 | " .+@.. ", |
55 | " .+@@. ", | 56 | " .+@@. ", |
56 | " .+@@. ", | 57 | " .+@@. ", |
57 | " .+@@. ", | 58 | " .+@@. ", |
58 | " .@.@. ", | 59 | " .@.@. ", |
59 | " .@@. ", | 60 | " .@@. ", |
60 | " .... ", | 61 | " .... ", |
61 | " .. ", | 62 | " .. ", |
62 | " "}; | 63 | " "}; |
63 | 64 | ||
64 | 65 | ||
65 | /* XPM */ | 66 | /* XPM */ |
66 | static char * bs_xpm[] = { | 67 | static char * bs_xpm[] = { |
67 | "12 12 5 1", | 68 | "12 12 5 1", |
68 | " c None", | 69 | " c None", |
69 | ".c #333333", | 70 | ".c #333333", |
70 | "+c #000000", | 71 | "+c #000000", |
71 | "@c #FFFFFF", | 72 | "@c #FFFFFF", |
72 | "#c #666666", | 73 | "#c #666666", |
73 | " ", | 74 | " ", |
74 | " ", | 75 | " ", |
75 | " ", | 76 | " ", |
76 | " . ", | 77 | " . ", |
77 | " ++ ", | 78 | " ++ ", |
78 | " +@#+++++. ", | 79 | " +@#+++++. ", |
79 | " +@@@@@@@@+ ", | 80 | " +@@@@@@@@+ ", |
80 | " +@#+++++. ", | 81 | " +@#+++++. ", |
81 | " ++ ", | 82 | " ++ ", |
82 | " . ", | 83 | " . ", |
83 | " ", | 84 | " ", |
84 | " "}; | 85 | " "}; |
85 | 86 | ||
86 | 87 | ||
87 | /* XPM */ | 88 | /* XPM */ |
88 | static char * enter_xpm[] = { | 89 | static char * enter_xpm[] = { |
89 | "12 12 5 1", | 90 | "12 12 5 1", |
90 | " c None", | 91 | " c None", |
91 | ".c #333333", | 92 | ".c #333333", |
92 | "+c #000000", | 93 | "+c #000000", |
93 | "@c #FFFFFF", | 94 | "@c #FFFFFF", |
94 | "#c #666666", | 95 | "#c #666666", |
95 | " ", | 96 | " ", |
96 | " .+. ", | 97 | " .+. ", |
97 | " +@+ ", | 98 | " +@+ ", |
98 | " . +@+ ", | 99 | " . +@+ ", |
99 | " ++ +@+ ", | 100 | " ++ +@+ ", |
100 | " +@#++++@+ ", | 101 | " +@#++++@+ ", |
101 | " +@@@@@@@@+ ", | 102 | " +@@@@@@@@+ ", |
102 | " +@#+++++. ", | 103 | " +@#+++++. ", |
103 | " ++ ", | 104 | " ++ ", |
104 | " . ", | 105 | " . ", |
105 | " ", | 106 | " ", |
106 | " "}; | 107 | " "}; |
107 | 108 | ||
108 | 109 | ||
109 | 110 | ||
110 | /* XPM */ | 111 | /* XPM */ |
111 | static char * help_xpm[] = { | 112 | static char * help_xpm[] = { |
112 | "12 12 5 1", | 113 | "12 12 5 1", |
113 | " c None", | 114 | " c None", |
114 | ".c #000000", | 115 | ".c #000000", |
115 | "+c #FFFFFF", | 116 | "+c #FFFFFF", |
116 | "@c #666666", | 117 | "@c #666666", |
117 | "#c #333333", | 118 | "#c #333333", |
118 | " ", | 119 | " ", |
119 | " ... ", | 120 | " ... ", |
120 | " .+++. ", | 121 | " .+++. ", |
121 | " .+..@+. ", | 122 | " .+..@+. ", |
122 | " #.# .+. ", | 123 | " #.# .+. ", |
123 | " .+. ", | 124 | " .+. ", |
124 | " .+. ", | 125 | " .+. ", |
125 | " .+. ", | 126 | " .+. ", |
126 | " .+. ", | 127 | " .+. ", |
127 | " #.# ", | 128 | " #.# ", |
128 | " .+. ", | 129 | " .+. ", |
129 | " #.# "}; | 130 | " #.# "}; |
130 | 131 | ||
131 | 132 | ||
132 | /*! | 133 | /*! |
133 | \class QIMPenInput qimpeninput.h | 134 | \class QIMPenInput qimpeninput.h |
134 | 135 | ||
@@ -226,290 +227,291 @@ QIMPenInput::~QIMPenInput() | |||
226 | } | 227 | } |
227 | 228 | ||
228 | QSize QIMPenInput::sizeHint() const | 229 | QSize QIMPenInput::sizeHint() const |
229 | { | 230 | { |
230 | int fw = frameWidth(); | 231 | int fw = frameWidth(); |
231 | int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height(); | 232 | int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height(); |
232 | return pw->sizeHint() + QSize( fw*2, fw*2+ps ); | 233 | return pw->sizeHint() + QSize( fw*2, fw*2+ps ); |
233 | } | 234 | } |
234 | 235 | ||
235 | void QIMPenInput::loadProfiles() | 236 | void QIMPenInput::loadProfiles() |
236 | { | 237 | { |
237 | profileList.clear(); | 238 | profileList.clear(); |
238 | profile = 0; | 239 | profile = 0; |
239 | delete shortcutCharSet; | 240 | delete shortcutCharSet; |
240 | shortcutCharSet = new QIMPenCharSet(); | 241 | shortcutCharSet = new QIMPenCharSet(); |
241 | shortcutCharSet->setTitle( tr("Shortcut") ); | 242 | shortcutCharSet->setTitle( tr("Shortcut") ); |
242 | QString path = QPEApplication::qpeDir() + "etc/qimpen"; | 243 | QString path = QPEApplication::qpeDir() + "etc/qimpen"; |
243 | QDir dir( path, "*.conf" ); | 244 | QDir dir( path, "*.conf" ); |
244 | QStringList list = dir.entryList(); | 245 | QStringList list = dir.entryList(); |
245 | QStringList::Iterator it; | 246 | QStringList::Iterator it; |
246 | for ( it = list.begin(); it != list.end(); ++it ) { | 247 | for ( it = list.begin(); it != list.end(); ++it ) { |
247 | QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); | 248 | QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); |
248 | profileList.append( p ); | 249 | profileList.append( p ); |
249 | if ( p->shortcut() ) { | 250 | if ( p->shortcut() ) { |
250 | QIMPenCharIterator it( p->shortcut()->characters() ); | 251 | QIMPenCharIterator it( p->shortcut()->characters() ); |
251 | for ( ; it.current(); ++it ) { | 252 | for ( ; it.current(); ++it ) { |
252 | shortcutCharSet->addChar( new QIMPenChar(*it.current()) ); | 253 | shortcutCharSet->addChar( new QIMPenChar(*it.current()) ); |
253 | } | 254 | } |
254 | } | 255 | } |
255 | } | 256 | } |
256 | 257 | ||
257 | Config config( "handwriting" ); | 258 | Config config( "handwriting" ); |
258 | config.setGroup( "Settings" ); | 259 | config.setGroup( "Settings" ); |
259 | QString prof = config.readEntry( "Profile", "Default" ); | 260 | QString prof = config.readEntry( "Profile", "Default" ); |
260 | selectProfile( prof ); | 261 | selectProfile( prof ); |
261 | } | 262 | } |
262 | 263 | ||
263 | void QIMPenInput::selectProfile( const QString &name ) | 264 | void QIMPenInput::selectProfile( const QString &name ) |
264 | { | 265 | { |
265 | QListIterator<QIMPenProfile> it( profileList ); | 266 | QListIterator<QIMPenProfile> it( profileList ); |
266 | for ( ; it.current(); ++it ) { | 267 | for ( ; it.current(); ++it ) { |
267 | if ( it.current()->name() == name ) { | 268 | if ( it.current()->name() == name ) { |
268 | profile = it.current(); | 269 | profile = it.current(); |
269 | break; | 270 | break; |
270 | } | 271 | } |
271 | } | 272 | } |
272 | 273 | ||
273 | if ( !it.current() ) | 274 | if ( !it.current() ) |
274 | return; | 275 | return; |
275 | 276 | ||
276 | pw->clearCharSets(); | 277 | pw->clearCharSets(); |
277 | baseSets.clear(); | 278 | baseSets.clear(); |
278 | 279 | ||
279 | matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() ); | 280 | matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() ); |
280 | matcher->setWordMatchingEnabled( profile->matchWords() ); | 281 | matcher->setWordMatchingEnabled( profile->matchWords() ); |
281 | 282 | ||
282 | if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) | 283 | if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) |
283 | wordPicker->hide(); | 284 | wordPicker->hide(); |
284 | else | 285 | else |
285 | wordPicker->show(); | 286 | wordPicker->show(); |
286 | 287 | ||
287 | if ( profile->uppercase() && profile->style() == QIMPenProfile::BothCases ) { | 288 | if ( profile->uppercase() && profile->style() == QIMPenProfile::BothCases ) { |
288 | baseSets.append( profile->uppercase() ); | 289 | baseSets.append( profile->uppercase() ); |
289 | pw->insertCharSet( profile->uppercase() ); | 290 | pw->insertCharSet( profile->uppercase() ); |
290 | } | 291 | } |
291 | 292 | ||
292 | if ( profile->lowercase() ) { | 293 | if ( profile->lowercase() ) { |
293 | baseSets.append( profile->lowercase() ); | 294 | baseSets.append( profile->lowercase() ); |
294 | pw->insertCharSet( profile->lowercase(), profile->style() == QIMPenProfile::BothCases ? 1 : 2 ); | 295 | pw->insertCharSet( profile->lowercase(), profile->style() == QIMPenProfile::BothCases ? 1 : 2 ); |
295 | } | 296 | } |
296 | 297 | ||
297 | if ( profile->numeric() ) { | 298 | if ( profile->numeric() ) { |
298 | baseSets.append( profile->numeric() ); | 299 | baseSets.append( profile->numeric() ); |
299 | pw->insertCharSet( profile->numeric() ); | 300 | pw->insertCharSet( profile->numeric() ); |
300 | } | 301 | } |
301 | 302 | ||
302 | if ( helpDlg ) | 303 | if ( helpDlg ) |
303 | delete (HandwritingHelp*) helpDlg; | 304 | delete (HandwritingHelp*) helpDlg; |
304 | } | 305 | } |
305 | 306 | ||
306 | void QIMPenInput::wordPicked( const QString &w ) | 307 | void QIMPenInput::wordPicked( const QString &w ) |
307 | { | 308 | { |
308 | int bs = matcher->word().length(); | 309 | int bs = matcher->word().length(); |
309 | for ( int i = 0; i < bs; i++ ) | 310 | for ( int i = 0; i < bs; i++ ) |
310 | keypress( Qt::Key_Backspace << 16 ); | 311 | keypress( Qt::Key_Backspace << 16 ); |
311 | 312 | ||
312 | for ( unsigned int i = 0; i < w.length(); i++ ) | 313 | for ( unsigned int i = 0; i < w.length(); i++ ) |
313 | keypress( w[i].unicode() ); | 314 | keypress( w[i].unicode() ); |
314 | 315 | ||
315 | matcher->resetState(); | 316 | matcher->resetState(); |
316 | wordPicker->clear(); | 317 | wordPicker->clear(); |
317 | } | 318 | } |
318 | 319 | ||
319 | void QIMPenInput::selectCharSet( int idx ) | 320 | void QIMPenInput::selectCharSet( int idx ) |
320 | { | 321 | { |
321 | if ( mode == Switch ) { | 322 | if ( mode == Switch ) { |
322 | //qDebug( "Switch back to normal" ); | 323 | //odebug << "Switch back to normal" << oendl; |
323 | pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); | 324 | pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); |
324 | mode = Normal; | 325 | mode = Normal; |
325 | } | 326 | } |
326 | currCharSet = idx; | 327 | currCharSet = idx; |
327 | } | 328 | } |
328 | 329 | ||
329 | void QIMPenInput::beginStroke() | 330 | void QIMPenInput::beginStroke() |
330 | { | 331 | { |
331 | } | 332 | } |
332 | 333 | ||
333 | void QIMPenInput::strokeEntered( QIMPenStroke * ) | 334 | void QIMPenInput::strokeEntered( QIMPenStroke * ) |
334 | { | 335 | { |
335 | pw->greyStroke(); | 336 | pw->greyStroke(); |
336 | } | 337 | } |
337 | 338 | ||
338 | void QIMPenInput::erase() | 339 | void QIMPenInput::erase() |
339 | { | 340 | { |
340 | keypress( Qt::Key_Backspace << 16 ); | 341 | keypress( Qt::Key_Backspace << 16 ); |
341 | } | 342 | } |
342 | 343 | ||
343 | void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl ) | 344 | void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl ) |
344 | { | 345 | { |
345 | const QIMPenChar *ch = cl.first().penChar; | 346 | const QIMPenChar *ch = cl.first().penChar; |
346 | int scan = ch->character() >> 16; | 347 | int scan = ch->character() >> 16; |
347 | 348 | ||
348 | if ( scan < QIMPenChar::ModeBase ) | 349 | if ( scan < QIMPenChar::ModeBase ) |
349 | return; | 350 | return; |
350 | 351 | ||
351 | // We matched a special character... | 352 | // We matched a special character... |
352 | 353 | ||
353 | switch ( scan ) { | 354 | switch ( scan ) { |
354 | case QIMPenChar::Caps: | 355 | case QIMPenChar::Caps: |
355 | if ( profile->style() == QIMPenProfile::ToggleCases ) { | 356 | if ( profile->style() == QIMPenProfile::ToggleCases ) { |
356 | // qDebug( "Caps" ); | 357 | // odebug << "Caps" << oendl; |
358 | // | ||
357 | if ( mode == SwitchLock ) { | 359 | if ( mode == SwitchLock ) { |
358 | // qDebug( "Switch to normal" ); | 360 | // odebug << "Switch to normal" << oendl; |
359 | pw->changeCharSet( profile->lowercase(), currCharSet ); | 361 | pw->changeCharSet( profile->lowercase(), currCharSet ); |
360 | mode = Switch; | 362 | mode = Switch; |
361 | } else { | 363 | } else { |
362 | // qDebug( "Switch to upper" ); | 364 | // odebug << "Switch to upper" << oendl; |
363 | pw->changeCharSet( profile->uppercase(), currCharSet ); | 365 | pw->changeCharSet( profile->uppercase(), currCharSet ); |
364 | mode = Switch; | 366 | mode = Switch; |
365 | } | 367 | } |
366 | } | 368 | } |
367 | break; | 369 | break; |
368 | case QIMPenChar::CapsLock: | 370 | case QIMPenChar::CapsLock: |
369 | if ( profile->style() == QIMPenProfile::ToggleCases ) { | 371 | if ( profile->style() == QIMPenProfile::ToggleCases ) { |
370 | // qDebug( "CapsLock" ); | 372 | // odebug << "CapsLock" << oendl; |
371 | if ( mode == Switch && | 373 | if ( mode == Switch && |
372 | baseSets.at(currCharSet) == profile->uppercase() ) { | 374 | baseSets.at(currCharSet) == profile->uppercase() ) { |
373 | // qDebug( "Switch to normal" ); | 375 | // odebug << "Switch to normal" << oendl; |
374 | pw->changeCharSet( profile->lowercase(), currCharSet ); | 376 | pw->changeCharSet( profile->lowercase(), currCharSet ); |
375 | // change our base set back to lower. | 377 | // change our base set back to lower. |
376 | baseSets.remove( currCharSet ); | 378 | baseSets.remove( currCharSet ); |
377 | baseSets.insert( currCharSet, profile->lowercase() ); | 379 | baseSets.insert( currCharSet, profile->lowercase() ); |
378 | mode = Normal; | 380 | mode = Normal; |
379 | } else { | 381 | } else { |
380 | // qDebug( "Switch to caps lock" ); | 382 | // odebug << "Switch to caps lock" << oendl; |
381 | pw->changeCharSet( profile->uppercase(), currCharSet ); | 383 | pw->changeCharSet( profile->uppercase(), currCharSet ); |
382 | // change our base set to upper. | 384 | // change our base set to upper. |
383 | baseSets.remove( currCharSet ); | 385 | baseSets.remove( currCharSet ); |
384 | baseSets.insert( currCharSet, profile->uppercase() ); | 386 | baseSets.insert( currCharSet, profile->uppercase() ); |
385 | mode = SwitchLock; | 387 | mode = SwitchLock; |
386 | } | 388 | } |
387 | } | 389 | } |
388 | break; | 390 | break; |
389 | case QIMPenChar::Punctuation: | 391 | case QIMPenChar::Punctuation: |
390 | if ( profile->punctuation() ) { | 392 | if ( profile->punctuation() ) { |
391 | //qDebug( "Switch to punctuation" ); | 393 | //odebug << "Switch to punctuation" << oendl; |
392 | pw->changeCharSet( profile->punctuation(), currCharSet ); | 394 | pw->changeCharSet( profile->punctuation(), currCharSet ); |
393 | mode = Switch; | 395 | mode = Switch; |
394 | } | 396 | } |
395 | break; | 397 | break; |
396 | case QIMPenChar::Symbol: | 398 | case QIMPenChar::Symbol: |
397 | if ( profile->symbol() ) { | 399 | if ( profile->symbol() ) { |
398 | //qDebug( "Switch to symbol" ); | 400 | //odebug << "Switch to symbol" << oendl ; |
399 | pw->changeCharSet( profile->symbol(), currCharSet ); | 401 | pw->changeCharSet( profile->symbol(), currCharSet ); |
400 | mode = Switch; | 402 | mode = Switch; |
401 | } | 403 | } |
402 | break; | 404 | break; |
403 | case QIMPenChar::Shortcut: | 405 | case QIMPenChar::Shortcut: |
404 | if ( shortcutCharSet ) { | 406 | if ( shortcutCharSet ) { |
405 | pw->changeCharSet( shortcutCharSet, currCharSet ); | 407 | pw->changeCharSet( shortcutCharSet, currCharSet ); |
406 | mode = Switch; | 408 | mode = Switch; |
407 | } | 409 | } |
408 | break; | 410 | break; |
409 | case QIMPenChar::Extended: | 411 | case QIMPenChar::Extended: |
410 | handleExtended( ch->data() ); | 412 | handleExtended( ch->data() ); |
411 | break; | 413 | break; |
412 | } | 414 | } |
413 | } | 415 | } |
414 | 416 | ||
415 | void QIMPenInput::keypress( uint scan_uni ) | 417 | void QIMPenInput::keypress( uint scan_uni ) |
416 | { | 418 | { |
417 | int scan = scan_uni >> 16; | 419 | int scan = scan_uni >> 16; |
418 | if ( !scan ) { | 420 | if ( !scan ) { |
419 | if ( scan_uni >= 'a' && scan_uni <= 'z' ) { | 421 | if ( scan_uni >= 'a' && scan_uni <= 'z' ) { |
420 | scan = Qt::Key_A + scan_uni - 'a'; | 422 | scan = Qt::Key_A + scan_uni - 'a'; |
421 | } else if ( scan_uni >= 'A' && scan_uni <= 'Z' ) { | 423 | } else if ( scan_uni >= 'A' && scan_uni <= 'Z' ) { |
422 | scan = Qt::Key_A + scan_uni - 'A'; | 424 | scan = Qt::Key_A + scan_uni - 'A'; |
423 | } else if ( scan_uni == ' ' ) { | 425 | } else if ( scan_uni == ' ' ) { |
424 | scan = Qt::Key_Space; | 426 | scan = Qt::Key_Space; |
425 | } | 427 | } |
426 | } | 428 | } |
427 | 429 | ||
428 | switch ( scan ) { | 430 | switch ( scan ) { |
429 | case Key_Tab: | 431 | case Key_Tab: |
430 | scan_uni = 9; | 432 | scan_uni = 9; |
431 | break; | 433 | break; |
432 | case Key_Return: | 434 | case Key_Return: |
433 | scan_uni = 13; | 435 | scan_uni = 13; |
434 | break; | 436 | break; |
435 | case Key_Backspace: | 437 | case Key_Backspace: |
436 | scan_uni = 8; | 438 | scan_uni = 8; |
437 | break; | 439 | break; |
438 | case Key_Escape: | 440 | case Key_Escape: |
439 | scan_uni = 27; | 441 | scan_uni = 27; |
440 | break; | 442 | break; |
441 | default: | 443 | default: |
442 | break; | 444 | break; |
443 | } | 445 | } |
444 | 446 | ||
445 | if ( mode == Switch ) { | 447 | if ( mode == Switch ) { |
446 | //qDebug( "Switch back to normal" ); | 448 | //odebug << "Switch back to normal" << oendl ; |
447 | pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); | 449 | pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); |
448 | if ( baseSets.at(currCharSet) == profile->uppercase() ) | 450 | if ( baseSets.at(currCharSet) == profile->uppercase() ) |
449 | mode = SwitchLock; | 451 | mode = SwitchLock; |
450 | else | 452 | else |
451 | mode = Normal; | 453 | mode = Normal; |
452 | } | 454 | } |
453 | 455 | ||
454 | emit key( scan_uni&0xffff, scan, 0, true, false ); | 456 | emit key( scan_uni&0xffff, scan, 0, true, false ); |
455 | emit key( scan_uni&0xffff, scan, 0, false, false ); | 457 | emit key( scan_uni&0xffff, scan, 0, false, false ); |
456 | } | 458 | } |
457 | 459 | ||
458 | void QIMPenInput::handleExtended( const QString &ex ) | 460 | void QIMPenInput::handleExtended( const QString &ex ) |
459 | { | 461 | { |
460 | if ( ex.find( "Select" ) == 0 ) { | 462 | if ( ex.find( "Select" ) == 0 ) { |
461 | QString set = ex.mid( 7 ); | 463 | QString set = ex.mid( 7 ); |
462 | qDebug( "Select new profile: %s", set.latin1() ); | 464 | odebug << "Select new profile: " << set.latin1() << oendl; |
463 | selectProfile( set ); | 465 | selectProfile( set ); |
464 | } | 466 | } |
465 | } | 467 | } |
466 | 468 | ||
467 | void QIMPenInput::help() | 469 | void QIMPenInput::help() |
468 | { | 470 | { |
469 | if ( helpDlg ) | 471 | if ( helpDlg ) |
470 | delete (HandwritingHelp*) helpDlg; | 472 | delete (HandwritingHelp*) helpDlg; |
471 | helpDlg = new HandwritingHelp( profile, 0, 0, WDestructiveClose ); | 473 | helpDlg = new HandwritingHelp( profile, 0, 0, WDestructiveClose ); |
472 | helpDlg->showMaximized(); | 474 | helpDlg->showMaximized(); |
473 | helpDlg->show(); | 475 | helpDlg->show(); |
474 | helpDlg->raise(); | 476 | helpDlg->raise(); |
475 | } | 477 | } |
476 | 478 | ||
477 | /*! | 479 | /*! |
478 | Open the setup dialog | 480 | Open the setup dialog |
479 | */ | 481 | */ |
480 | void QIMPenInput::setup() | 482 | void QIMPenInput::setup() |
481 | { | 483 | { |
482 | if ( !setupDlg ) { | 484 | if ( !setupDlg ) { |
483 | // We are working with our copy of the char sets here. | 485 | // We are working with our copy of the char sets here. |
484 | setupDlg = new QIMPenSetup( profile, 0, 0, TRUE ); | 486 | setupDlg = new QIMPenSetup( profile, 0, 0, TRUE ); |
485 | setupDlg->editor()->selectCharSet( profile->charSets().at(1) );// lower case? This is crap. | 487 | setupDlg->editor()->selectCharSet( profile->charSets().at(1) );// lower case? This is crap. |
486 | if ( qApp->desktop()->width() < 640 ) | 488 | if ( qApp->desktop()->width() < 640 ) |
487 | setupDlg->showMaximized(); | 489 | setupDlg->showMaximized(); |
488 | Global::hideInputMethod(); | 490 | Global::hideInputMethod(); |
489 | setupDlg->exec(); | 491 | setupDlg->exec(); |
490 | loadProfiles(); | 492 | loadProfiles(); |
491 | delete setupDlg; | 493 | delete setupDlg; |
492 | setupDlg = 0; | 494 | setupDlg = 0; |
493 | Global::showInputMethod(); | 495 | Global::showInputMethod(); |
494 | } else { | 496 | } else { |
495 | setupDlg->raise(); | 497 | setupDlg->raise(); |
496 | } | 498 | } |
497 | } | 499 | } |
498 | 500 | ||
499 | void QIMPenInput::backspace() | 501 | void QIMPenInput::backspace() |
500 | { | 502 | { |
501 | keypress( Qt::Key_Backspace << 16 ); | 503 | keypress( Qt::Key_Backspace << 16 ); |
502 | matcher->backspace(); | 504 | matcher->backspace(); |
503 | } | 505 | } |
504 | 506 | ||
505 | void QIMPenInput::enter() | 507 | void QIMPenInput::enter() |
506 | { | 508 | { |
507 | keypress( Qt::Key_Return << 16 ); | 509 | keypress( Qt::Key_Return << 16 ); |
508 | matcher->resetState(); | 510 | matcher->resetState(); |
509 | } | 511 | } |
510 | 512 | ||
511 | 513 | ||
512 | void QIMPenInput::resetState() | 514 | void QIMPenInput::resetState() |
513 | { | 515 | { |
514 | matcher->resetState(); | 516 | matcher->resetState(); |
515 | } | 517 | } |