-rw-r--r-- | inputmethods/pickboard/pickboard.cpp | 25 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardcfg.cpp | 59 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardcfg.h | 19 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardimpl.cpp | 6 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardpicks.cpp | 31 |
5 files changed, 86 insertions, 54 deletions
diff --git a/inputmethods/pickboard/pickboard.cpp b/inputmethods/pickboard/pickboard.cpp index 087144e..1611cb0 100644 --- a/inputmethods/pickboard/pickboard.cpp +++ b/inputmethods/pickboard/pickboard.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
@@ -35,5 +35,23 @@ | |||
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #ifdef QWS | ||
37 | #include <qwindowsystem_qws.h> | 38 | #include <qwindowsystem_qws.h> |
39 | #endif | ||
40 | |||
41 | /*! \class Pickboard | ||
42 | \brief The Pickboard class provides an input method | ||
43 | based on a virtual keyboard combined with word-completion. | ||
44 | |||
45 | This version of Pickboard is Dual Licensed Software. However, for you to be | ||
46 | able to license the technology to others, you may require a T9(R) Text | ||
47 | Input license from Tegic Communications Corporation. More information can | ||
48 | be found at http://www.t9.com/. | ||
49 | |||
50 | \legalese | ||
51 | This version of Pickboard is Dual Licensed Software. However, for you to be | ||
52 | able to license the technology to others, you may require a T9(R) Text | ||
53 | Input license from Tegic Communications Corporation. More information can | ||
54 | be found at http://www.t9.com/. | ||
55 | */ | ||
38 | 56 | ||
39 | /* XPM */ | 57 | /* XPM */ |
@@ -75,5 +93,8 @@ Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) : | |||
75 | (new QHBoxLayout(this))->setAutoAdd(TRUE); | 93 | (new QHBoxLayout(this))->setAutoAdd(TRUE); |
76 | d = new PickboardPrivate(this); | 94 | d = new PickboardPrivate(this); |
95 | // under Win32 we may not have smallsmooth font | ||
96 | #ifndef Q_OS_WIN32 | ||
77 | setFont( QFont( "smallsmooth", 9 ) ); | 97 | setFont( QFont( "smallsmooth", 9 ) ); |
98 | #endif | ||
78 | } | 99 | } |
79 | 100 | ||
diff --git a/inputmethods/pickboard/pickboardcfg.cpp b/inputmethods/pickboard/pickboardcfg.cpp index d500266..70a89cd 100644 --- a/inputmethods/pickboard/pickboardcfg.cpp +++ b/inputmethods/pickboard/pickboardcfg.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
@@ -35,8 +35,10 @@ | |||
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #ifdef QWS | ||
37 | #include <qwindowsystem_qws.h> | 38 | #include <qwindowsystem_qws.h> |
39 | #endif | ||
38 | 40 | ||
39 | static const char * pickboard_help = | 41 | static const char * pickboard_help = |
40 | "<h1>The Pickboard</h1>" | 42 | QT_TRANSLATE_NOOP("PickboardConfig", "<h1>The Pickboard</h1>" |
41 | "<i>The smallest and fastest way to type.</i>" | 43 | "<i>The smallest and fastest way to type.</i>" |
42 | "<p>" | 44 | "<p>" |
@@ -45,5 +47,5 @@ static const char * pickboard_help = | |||
45 | "<br>Use \"Shift\" to capitalize words that are not normally capitalized." | 47 | "<br>Use \"Shift\" to capitalize words that are not normally capitalized." |
46 | "<br>Press \"Shift\" twice for an all-capitals word." | 48 | "<br>Press \"Shift\" twice for an all-capitals word." |
47 | "<br>Add custom words by picking them, then selecting \"Add...\" from the menu on the right." | 49 | "<br>Add custom words by picking them, then selecting \"Add...\" from the menu on the right." ) |
48 | ; | 50 | ; |
49 | 51 | ||
@@ -77,6 +79,10 @@ void PickboardConfig::generateText(const QString& s) | |||
77 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 79 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
78 | for (int i=0; i<(int)s.length(); i++) { | 80 | for (int i=0; i<(int)s.length(); i++) { |
79 | parent->emitKey(s[i].unicode(), 0, 0, true, false); | 81 | uint code = 0; |
80 | parent->emitKey(s[i].unicode(), 0, 0, false, false); | 82 | if ( s[i].unicode() >= 'a' && s[i].unicode() <= 'z' ) { |
83 | code = s[i].unicode() - 'a' + Key_A; | ||
84 | } | ||
85 | parent->emitKey(s[i].unicode(), code, 0, true, false); | ||
86 | parent->emitKey(s[i].unicode(), code, 0, false, false); | ||
81 | } | 87 | } |
82 | #endif | 88 | #endif |
@@ -113,7 +119,7 @@ void PickboardConfig::pickPoint(const QPoint& p, bool press) | |||
113 | void PickboardConfig::fillMenu(QPopupMenu& menu) | 119 | void PickboardConfig::fillMenu(QPopupMenu& menu) |
114 | { | 120 | { |
115 | menu.insertItem("Reset",100); | 121 | menu.insertItem(tr("Reset"),100); |
116 | menu.insertSeparator(); | 122 | menu.insertSeparator(); |
117 | menu.insertItem("Help",1); | 123 | menu.insertItem(tr("Help"),1); |
118 | } | 124 | } |
119 | 125 | ||
@@ -128,5 +134,5 @@ void PickboardConfig::doMenu(int i) | |||
128 | break; | 134 | break; |
129 | case 1: { | 135 | case 1: { |
130 | QMessageBox help("Pickboard Help", pickboard_help, | 136 | QMessageBox help(tr("Pickboard Help"), tr(pickboard_help), |
131 | QMessageBox::NoIcon, 1, 0, 0); | 137 | QMessageBox::NoIcon, 1, 0, 0); |
132 | help.showMaximized(); | 138 | help.showMaximized(); |
@@ -159,8 +165,8 @@ void StringConfig::draw(QPainter* p) | |||
159 | int w = fm.width(s)+xw; | 165 | int w = fm.width(s)+xw; |
160 | if ( highlight(r,i) ) { | 166 | if ( highlight(r,i) ) { |
161 | p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),::Qt::black); | 167 | p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),Qt::black); |
162 | p->setPen(::Qt::white); | 168 | p->setPen(Qt::white); |
163 | }else{ | 169 | }else{ |
164 | p->setPen(::Qt::black); | 170 | p->setPen(Qt::black); |
165 | } | 171 | } |
166 | p->drawText(x,-fm.descent()-1,s); | 172 | p->drawText(x,-fm.descent()-1,s); |
@@ -294,7 +300,7 @@ PickboardAdd::PickboardAdd(QWidget* owner, const QStringList& setlist) : | |||
294 | QHBox* hb = new QHBox(this); | 300 | QHBox* hb = new QHBox(this); |
295 | hb->setSpacing(0); | 301 | hb->setSpacing(0); |
296 | yes = new QPushButton("OK",hb); | 302 | yes = new QPushButton(tr("OK"),hb); |
297 | yes->setEnabled(FALSE); | 303 | yes->setEnabled(FALSE); |
298 | QPushButton *no = new QPushButton("Cancel",hb); | 304 | QPushButton *no = new QPushButton(tr("Cancel"),hb); |
299 | connect(yes, SIGNAL(clicked()), this, SLOT(accept())); | 305 | connect(yes, SIGNAL(clicked()), this, SLOT(accept())); |
300 | connect(no, SIGNAL(clicked()), this, SLOT(reject())); | 306 | connect(no, SIGNAL(clicked()), this, SLOT(reject())); |
@@ -344,9 +350,9 @@ void DictFilterConfig::doMenu(int i) | |||
344 | case 300: | 350 | case 300: |
345 | if ( input.count() == 0 ) { | 351 | if ( input.count() == 0 ) { |
346 | QMessageBox::information(0, "Adding Words", | 352 | QMessageBox::information(0, tr("Adding Words"), |
347 | "To add words, pick the letters,\nthen " | 353 | tr("To add words, pick the letters,\nthen " |
348 | "open the Add dialog. In that\ndialog, tap " | 354 | "open the Add dialog. In that\ndialog, tap " |
349 | "the correct letters\nfrom the list " | 355 | "the correct letters\nfrom the list " |
350 | "(tap twice for\ncapitals)."); | 356 | "(tap twice for\ncapitals).")); |
351 | } else { | 357 | } else { |
352 | PickboardAdd add(parent,capitalize(input)); | 358 | PickboardAdd add(parent,capitalize(input)); |
@@ -375,5 +381,5 @@ void DictFilterConfig::doMenu(int i) | |||
375 | QString DictFilterConfig::text(int r, int i) | 381 | QString DictFilterConfig::text(int r, int i) |
376 | { | 382 | { |
377 | QStringList l = r ? sets : input.isEmpty() ? othermodes : matches; | 383 | QStringList l = r ? sets_a : input.isEmpty() ? othermodes : matches; |
378 | return i < (int)l.count() ? | 384 | return i < (int)l.count() ? |
379 | (input.isEmpty() ? l[i] : capitalize(l[i])) | 385 | (input.isEmpty() ? l[i] : capitalize(l[i])) |
@@ -427,14 +433,14 @@ void DictFilterConfig::pick(bool press, int row, int item) | |||
427 | if ( input.isEmpty() ) { | 433 | if ( input.isEmpty() ) { |
428 | lit0 = item; | 434 | lit0 = item; |
429 | if ( othermodes[item] == "Space" ) { | 435 | if ( othermodes[item] == PickboardPicks::tr("Space") ) { |
430 | updateItem(row,item); | 436 | updateItem(row,item); |
431 | generateText(" "); | 437 | generateText(" "); |
432 | } else if ( othermodes[item] == "Back" ) { | 438 | } else if ( othermodes[item] == PickboardPicks::tr("Back") ) { |
433 | updateItem(row,item); | 439 | updateItem(row,item); |
434 | generateKey(::Qt::Key_Backspace); | 440 | generateKey(::Qt::Key_Backspace); |
435 | } else if ( othermodes[item] == "Enter" ) { | 441 | } else if ( othermodes[item] == PickboardPicks::tr("Enter") ) { |
436 | updateItem(row,item); | 442 | updateItem(row,item); |
437 | generateKey(::Qt::Key_Return); | 443 | generateKey(::Qt::Key_Return); |
438 | } else if ( othermodes[item] == "Shift" ) { | 444 | } else if ( othermodes[item] == PickboardPicks::tr("Shift") ) { |
439 | updateItem(row,item); | 445 | updateItem(row,item); |
440 | shift = (shift+1)%3; | 446 | shift = (shift+1)%3; |
@@ -456,5 +462,5 @@ void DictFilterConfig::pick(bool press, int row, int item) | |||
456 | } | 462 | } |
457 | if ( lit0 >= 0 ) { | 463 | if ( lit0 >= 0 ) { |
458 | if ( !shift || othermodes[lit0] != "Shift" ) { | 464 | if ( !shift || othermodes[lit0] != PickboardPicks::tr("Shift") ) { |
459 | updateItem(0,lit0); | 465 | updateItem(0,lit0); |
460 | lit0 = -1; | 466 | lit0 = -1; |
@@ -569,7 +575,8 @@ bool DictFilterConfig::highlight(int r,int c) const | |||
569 | 575 | ||
570 | 576 | ||
571 | void DictFilterConfig::addSet(const QString& s) | 577 | void DictFilterConfig::addSet(const QString& appearance, const QString& set) |
572 | { | 578 | { |
573 | sets.append(s); | 579 | sets_a.append( appearance ); |
580 | sets.append( set ); | ||
574 | } | 581 | } |
575 | 582 | ||
@@ -581,5 +588,5 @@ void DictFilterConfig::addMode(const QString& s) | |||
581 | void DictFilterConfig::fillMenu(QPopupMenu& menu) | 588 | void DictFilterConfig::fillMenu(QPopupMenu& menu) |
582 | { | 589 | { |
583 | menu.insertItem("Add...",300); | 590 | menu.insertItem(tr("Add..."),300); |
584 | StringConfig::fillMenu(menu); | 591 | StringConfig::fillMenu(menu); |
585 | } | 592 | } |
diff --git a/inputmethods/pickboard/pickboardcfg.h b/inputmethods/pickboard/pickboardcfg.h index b1913df..92c6420 100644 --- a/inputmethods/pickboard/pickboardcfg.h +++ b/inputmethods/pickboard/pickboardcfg.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
@@ -77,5 +77,6 @@ private: | |||
77 | }; | 77 | }; |
78 | 78 | ||
79 | class PickboardConfig : QObject { | 79 | class PickboardConfig : public QObject { |
80 | Q_OBJECT | ||
80 | public: | 81 | public: |
81 | PickboardConfig(PickboardPicks* p) : parent(p), nrows(2), pressx(-1) { } | 82 | PickboardConfig(PickboardPicks* p) : parent(p), nrows(2), pressx(-1) { } |
@@ -105,4 +106,5 @@ private: | |||
105 | 106 | ||
106 | class StringConfig : public PickboardConfig { | 107 | class StringConfig : public PickboardConfig { |
108 | Q_OBJECT | ||
107 | public: | 109 | public: |
108 | StringConfig(PickboardPicks* p) : PickboardConfig(p) { } | 110 | StringConfig(PickboardPicks* p) : PickboardConfig(p) { } |
@@ -113,5 +115,5 @@ protected: | |||
113 | virtual QString text(int r, int i)=0; | 115 | virtual QString text(int r, int i)=0; |
114 | virtual bool spreadRow(int i)=0; | 116 | virtual bool spreadRow(int i)=0; |
115 | virtual QColor rowColor(int) { return ::Qt::black; } | 117 | virtual QColor rowColor(int) { return Qt::black; } |
116 | virtual void pickInRow(int r, int xpos, bool press); | 118 | virtual void pickInRow(int r, int xpos, bool press); |
117 | virtual void updateItem(int r, int i); | 119 | virtual void updateItem(int r, int i); |
@@ -120,4 +122,5 @@ protected: | |||
120 | 122 | ||
121 | class CharStringConfig : public StringConfig { | 123 | class CharStringConfig : public StringConfig { |
124 | Q_OBJECT | ||
122 | QString input; | 125 | QString input; |
123 | QStringList chars; | 126 | QStringList chars; |
@@ -135,5 +138,7 @@ protected: | |||
135 | 138 | ||
136 | class DictFilterConfig : public StringConfig { | 139 | class DictFilterConfig : public StringConfig { |
140 | Q_OBJECT | ||
137 | QStringList matches; | 141 | QStringList matches; |
142 | QStringList sets_a; | ||
138 | QStringList sets; | 143 | QStringList sets; |
139 | QStringList othermodes; | 144 | QStringList othermodes; |
@@ -153,5 +158,5 @@ public: | |||
153 | } | 158 | } |
154 | 159 | ||
155 | void addSet(const QString& s); | 160 | void addSet(const QString& apperance, const QString& set); |
156 | void addMode(const QString& s); | 161 | void addMode(const QString& s); |
157 | 162 | ||
@@ -176,4 +181,5 @@ protected: | |||
176 | 181 | ||
177 | class CharConfig : public StringConfig { | 182 | class CharConfig : public StringConfig { |
183 | Q_OBJECT | ||
178 | QStringList chars1; | 184 | QStringList chars1; |
179 | QStringList chars2; | 185 | QStringList chars2; |
@@ -193,6 +199,5 @@ class KeycodeConfig : public PickboardConfig { | |||
193 | QValueList<QPixmap> keypm1; | 199 | QValueList<QPixmap> keypm1; |
194 | QValueList<QPixmap> keypm2; | 200 | QValueList<QPixmap> keypm2; |
195 | static const int xw = 8; | 201 | enum { xw = 8, xmarg = 8 }; |
196 | static const int xmarg = 8; | ||
197 | 202 | ||
198 | public: | 203 | public: |
diff --git a/inputmethods/pickboard/pickboardimpl.cpp b/inputmethods/pickboard/pickboardimpl.cpp index 9a21229..f839452 100644 --- a/inputmethods/pickboard/pickboardimpl.cpp +++ b/inputmethods/pickboard/pickboardimpl.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
@@ -28,5 +28,5 @@ static const char * pb_xpm[]={ | |||
28 | "28 7 2 1", | 28 | "28 7 2 1", |
29 | "# c #303030", | 29 | "# c #303030", |
30 | " c None", | 30 | " c None", // No tr |
31 | " ########################## ", | 31 | " ########################## ", |
32 | " # # # # # # # ", | 32 | " # # # # # # # ", |
diff --git a/inputmethods/pickboard/pickboardpicks.cpp b/inputmethods/pickboard/pickboardpicks.cpp index a80bbf8..b9d9928 100644 --- a/inputmethods/pickboard/pickboardpicks.cpp +++ b/inputmethods/pickboard/pickboardpicks.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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 |
@@ -34,5 +34,7 @@ | |||
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | #ifdef QWS | ||
36 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #endif | ||
37 | 39 | ||
38 | void PickboardPicks::doMenu() | 40 | void PickboardPicks::doMenu() |
@@ -249,4 +251,5 @@ PickboardPicks::PickboardPicks(QWidget* parent, const char* name, WFlags f ) : | |||
249 | QFrame(parent,name,f) | 251 | QFrame(parent,name,f) |
250 | { | 252 | { |
253 | configs.setAutoDelete( TRUE ); | ||
251 | } | 254 | } |
252 | 255 | ||
@@ -257,20 +260,16 @@ void PickboardPicks::initialise(void) | |||
257 | 260 | ||
258 | DictFilterConfig* dc = new DictFilterConfig(this); | 261 | DictFilterConfig* dc = new DictFilterConfig(this); |
259 | dc->addSet("ABC"); | 262 | QStringList sets_a = QStringList::split(' ',tr("ABC DEF GHI JKL MNO PQR STU VWX YZ-'")); |
260 | dc->addSet("DEF"); | 263 | QStringList sets = QStringList::split(' ', |
261 | dc->addSet("GHI"); | 264 | tr("ABC%/1iso8859-15 DEF%/1iso8859-15 GHI%/1iso8859-15 JKL MNO%/1iso8859-15 PQR%/1iso8859-15 STU%/1iso8859-15 VWX YZ-'%/1iso8859-15")); |
262 | dc->addSet("JKL"); | 265 | for (QStringList::ConstIterator it = sets.begin(), it_a = sets_a.begin(); it!=sets.end(); ++it,++it_a) |
263 | dc->addSet("MNO"); | 266 | dc->addSet(*it_a,*it); |
264 | dc->addSet("PQR"); | ||
265 | dc->addSet("STU"); | ||
266 | dc->addSet("VWX"); | ||
267 | dc->addSet("YZ-'"); | ||
268 | dc->addMode("123"); | 267 | dc->addMode("123"); |
269 | dc->addMode("@*!?"); | 268 | dc->addMode("@*!?"); |
270 | dc->addMode("KEY"); | 269 | dc->addMode(tr("KEY")); |
271 | dc->addMode("Space"); | 270 | dc->addMode(tr("Space")); |
272 | dc->addMode("Back"); | 271 | dc->addMode(tr("Back")); |
273 | dc->addMode("Enter"); | 272 | dc->addMode(tr("Enter")); |
274 | dc->addMode("Shift"); | 273 | dc->addMode(tr("Shift")); |
275 | configs.append(dc); | 274 | configs.append(dc); |
276 | 275 | ||