-rw-r--r-- | inputmethods/pickboard/pickboard.cpp | 25 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardcfg.cpp | 69 | ||||
-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, 91 insertions, 59 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,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -36,3 +36,21 @@ #include <qmessagebox.h> +#ifdef QWS #include <qwindowsystem_qws.h> +#endif + +/*! \class Pickboard + \brief The Pickboard class provides an input method + based on a virtual keyboard combined with word-completion. + + This version of Pickboard is Dual Licensed Software. However, for you to be + able to license the technology to others, you may require a T9(R) Text + Input license from Tegic Communications Corporation. More information can + be found at http://www.t9.com/. + + \legalese + This version of Pickboard is Dual Licensed Software. However, for you to be + able to license the technology to others, you may require a T9(R) Text + Input license from Tegic Communications Corporation. More information can + be found at http://www.t9.com/. +*/ @@ -76,3 +94,6 @@ Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) : d = new PickboardPrivate(this); +// under Win32 we may not have smallsmooth font +#ifndef Q_OS_WIN32 setFont( QFont( "smallsmooth", 9 ) ); +#endif } 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,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -36,6 +36,8 @@ #include <qmessagebox.h> +#ifdef QWS #include <qwindowsystem_qws.h> +#endif static const char * pickboard_help = - "<h1>The Pickboard</h1>" + QT_TRANSLATE_NOOP("PickboardConfig", "<h1>The Pickboard</h1>" "<i>The smallest and fastest way to type.</i>" @@ -46,3 +48,3 @@ static const char * pickboard_help = "<br>Press \"Shift\" twice for an all-capitals word." - "<br>Add custom words by picking them, then selecting \"Add...\" from the menu on the right." + "<br>Add custom words by picking them, then selecting \"Add...\" from the menu on the right." ) ; @@ -78,6 +80,10 @@ void PickboardConfig::generateText(const QString& s) for (int i=0; i<(int)s.length(); i++) { - parent->emitKey(s[i].unicode(), 0, 0, true, false); - parent->emitKey(s[i].unicode(), 0, 0, false, false); + uint code = 0; + if ( s[i].unicode() >= 'a' && s[i].unicode() <= 'z' ) { + code = s[i].unicode() - 'a' + Key_A; + } + parent->emitKey(s[i].unicode(), code, 0, true, false); + parent->emitKey(s[i].unicode(), code, 0, false, false); } -#endif +#endif } @@ -114,5 +120,5 @@ void PickboardConfig::fillMenu(QPopupMenu& menu) { - menu.insertItem("Reset",100); + menu.insertItem(tr("Reset"),100); menu.insertSeparator(); - menu.insertItem("Help",1); + menu.insertItem(tr("Help"),1); } @@ -129,3 +135,3 @@ void PickboardConfig::doMenu(int i) case 1: { - QMessageBox help("Pickboard Help", pickboard_help, + QMessageBox help(tr("Pickboard Help"), tr(pickboard_help), QMessageBox::NoIcon, 1, 0, 0); @@ -160,6 +166,6 @@ void StringConfig::draw(QPainter* p) if ( highlight(r,i) ) { - p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),::Qt::black); - p->setPen(::Qt::white); + p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),Qt::black); + p->setPen(Qt::white); }else{ - p->setPen(::Qt::black); + p->setPen(Qt::black); } @@ -295,5 +301,5 @@ PickboardAdd::PickboardAdd(QWidget* owner, const QStringList& setlist) : hb->setSpacing(0); - yes = new QPushButton("OK",hb); + yes = new QPushButton(tr("OK"),hb); yes->setEnabled(FALSE); - QPushButton *no = new QPushButton("Cancel",hb); + QPushButton *no = new QPushButton(tr("Cancel"),hb); connect(yes, SIGNAL(clicked()), this, SLOT(accept())); @@ -345,7 +351,7 @@ void DictFilterConfig::doMenu(int i) if ( input.count() == 0 ) { - QMessageBox::information(0, "Adding Words", - "To add words, pick the letters,\nthen " + QMessageBox::information(0, tr("Adding Words"), + tr("To add words, pick the letters,\nthen " "open the Add dialog. In that\ndialog, tap " "the correct letters\nfrom the list " - "(tap twice for\ncapitals)."); + "(tap twice for\ncapitals).")); } else { @@ -376,3 +382,3 @@ QString DictFilterConfig::text(int r, int i) { - QStringList l = r ? sets : input.isEmpty() ? othermodes : matches; + QStringList l = r ? sets_a : input.isEmpty() ? othermodes : matches; return i < (int)l.count() ? @@ -428,12 +434,12 @@ void DictFilterConfig::pick(bool press, int row, int item) lit0 = item; - if ( othermodes[item] == "Space" ) { + if ( othermodes[item] == PickboardPicks::tr("Space") ) { updateItem(row,item); generateText(" "); - } else if ( othermodes[item] == "Back" ) { + } else if ( othermodes[item] == PickboardPicks::tr("Back") ) { updateItem(row,item); generateKey(::Qt::Key_Backspace); - } else if ( othermodes[item] == "Enter" ) { - updateItem(row,item); + } else if ( othermodes[item] == PickboardPicks::tr("Enter") ) { + updateItem(row,item); generateKey(::Qt::Key_Return); - } else if ( othermodes[item] == "Shift" ) { + } else if ( othermodes[item] == PickboardPicks::tr("Shift") ) { updateItem(row,item); @@ -457,4 +463,4 @@ void DictFilterConfig::pick(bool press, int row, int item) if ( lit0 >= 0 ) { - if ( !shift || othermodes[lit0] != "Shift" ) { - updateItem(0,lit0); + if ( !shift || othermodes[lit0] != PickboardPicks::tr("Shift") ) { + updateItem(0,lit0); lit0 = -1; @@ -468,6 +474,6 @@ void DictFilterConfig::pick(bool press, int row, int item) add(sets[item]); - updateItem(1,item); + updateItem(1,item); updateRows(0,0); } else { - updateItem(1,lit1); + updateItem(1,lit1); lit1 = -1; @@ -570,5 +576,6 @@ bool DictFilterConfig::highlight(int r,int c) const -void DictFilterConfig::addSet(const QString& s) +void DictFilterConfig::addSet(const QString& appearance, const QString& set) { - sets.append(s); + sets_a.append( appearance ); + sets.append( set ); } @@ -582,3 +589,3 @@ void DictFilterConfig::fillMenu(QPopupMenu& menu) { - menu.insertItem("Add...",300); + menu.insertItem(tr("Add..."),300); StringConfig::fillMenu(menu); 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,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -78,3 +78,4 @@ private: -class PickboardConfig : QObject { +class PickboardConfig : public QObject { + Q_OBJECT public: @@ -106,2 +107,3 @@ private: class StringConfig : public PickboardConfig { + Q_OBJECT public: @@ -114,3 +116,3 @@ protected: virtual bool spreadRow(int i)=0; - virtual QColor rowColor(int) { return ::Qt::black; } + virtual QColor rowColor(int) { return Qt::black; } virtual void pickInRow(int r, int xpos, bool press); @@ -121,2 +123,3 @@ protected: class CharStringConfig : public StringConfig { + Q_OBJECT QString input; @@ -136,3 +139,5 @@ protected: class DictFilterConfig : public StringConfig { + Q_OBJECT QStringList matches; + QStringList sets_a; QStringList sets; @@ -154,3 +159,3 @@ public: - void addSet(const QString& s); + void addSet(const QString& apperance, const QString& set); void addMode(const QString& s); @@ -177,2 +182,3 @@ protected: class CharConfig : public StringConfig { + Q_OBJECT QStringList chars1; @@ -194,4 +200,3 @@ class KeycodeConfig : public PickboardConfig { QValueList<QPixmap> keypm2; - static const int xw = 8; - static const int xmarg = 8; + enum { xw = 8, xmarg = 8 }; 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,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -29,3 +29,3 @@ static const char * pb_xpm[]={ "# c #303030", -" c None", +" c None", // No tr " ########################## ", 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,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -35,3 +35,5 @@ #include <qmessagebox.h> +#ifdef QWS #include <qwindowsystem_qws.h> +#endif @@ -250,2 +252,3 @@ PickboardPicks::PickboardPicks(QWidget* parent, const char* name, WFlags f ) : { + configs.setAutoDelete( TRUE ); } @@ -258,18 +261,14 @@ void PickboardPicks::initialise(void) DictFilterConfig* dc = new DictFilterConfig(this); - dc->addSet("ABC"); - dc->addSet("DEF"); - dc->addSet("GHI"); - dc->addSet("JKL"); - dc->addSet("MNO"); - dc->addSet("PQR"); - dc->addSet("STU"); - dc->addSet("VWX"); - dc->addSet("YZ-'"); + QStringList sets_a = QStringList::split(' ',tr("ABC DEF GHI JKL MNO PQR STU VWX YZ-'")); + QStringList sets = QStringList::split(' ', + tr("ABC%/1iso8859-15 DEF%/1iso8859-15 GHI%/1iso8859-15 JKL MNO%/1iso8859-15 PQR%/1iso8859-15 STU%/1iso8859-15 VWX YZ-'%/1iso8859-15")); + for (QStringList::ConstIterator it = sets.begin(), it_a = sets_a.begin(); it!=sets.end(); ++it,++it_a) + dc->addSet(*it_a,*it); dc->addMode("123"); dc->addMode("@*!?"); - dc->addMode("KEY"); - dc->addMode("Space"); - dc->addMode("Back"); - dc->addMode("Enter"); - dc->addMode("Shift"); + dc->addMode(tr("KEY")); + dc->addMode(tr("Space")); + dc->addMode(tr("Back")); + dc->addMode(tr("Enter")); + dc->addMode(tr("Shift")); configs.append(dc); |