-rw-r--r-- | inputmethods/dvorak/dvorakimpl.cpp | 3 | ||||
-rw-r--r-- | inputmethods/handwriting/handwritingimpl.cpp | 3 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenhelp.cpp | 43 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpeninput.cpp | 17 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenprofile.cpp | 6 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.cpp | 10 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboardimpl.cpp | 3 | ||||
-rw-r--r-- | inputmethods/keyboard/keyboardimpl.cpp | 3 | ||||
-rw-r--r-- | inputmethods/kjumpx/keyboardimpl.cpp | 3 | ||||
-rw-r--r-- | inputmethods/pickboard/pickboardimpl.cpp | 3 | ||||
-rw-r--r-- | inputmethods/unikeyboard/unikeyboardimpl.cpp | 3 |
11 files changed, 44 insertions, 53 deletions
diff --git a/inputmethods/dvorak/dvorakimpl.cpp b/inputmethods/dvorak/dvorakimpl.cpp index d58b6b9..3c83464 100644 --- a/inputmethods/dvorak/dvorakimpl.cpp +++ b/inputmethods/dvorak/dvorakimpl.cpp @@ -55,77 +55,76 @@ static char * opti_xpm[] = { " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... ", " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... ", " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... ", " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... "}; KeyboardImpl::KeyboardImpl() : input(0), icn(0), ref(0) { } KeyboardImpl::~KeyboardImpl() { delete input; delete icn; } QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !input ) input = new Keyboard( parent, "Keyboard", f ); return input; } void KeyboardImpl::resetState() { if ( input ) input->resetState(); } QPixmap *KeyboardImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)kb_xpm ); return icn; } QString KeyboardImpl::name() { - // return qApp->translate( "InputMethods", "Dvorak" ); - return "Dvorak"; + return qApp->translate( "InputMethods", "Dvorak" ); } void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( input ) QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( KeyboardImpl ) } #endif diff --git a/inputmethods/handwriting/handwritingimpl.cpp b/inputmethods/handwriting/handwritingimpl.cpp index 0ea140c..c39e1aa 100644 --- a/inputmethods/handwriting/handwritingimpl.cpp +++ b/inputmethods/handwriting/handwritingimpl.cpp @@ -38,77 +38,76 @@ static const char * pen_xpm[] = { "* c #A3732C", " . ", " .+. ", " .@#$. ", " .@%&. ", " .@%&. ", " . .@%&. ", " . .@%&. ", " . .@%&. ", " ... ... .. .@%&. ", " . . . . . .*.&. ", " . . . . . .**. ", " ... ... .. ... ", " "}; HandwritingImpl::HandwritingImpl() : input(0), icn(0), ref(0) { } HandwritingImpl::~HandwritingImpl() { delete input; delete icn; } QWidget *HandwritingImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !input ) input = new QIMPenInput( parent, "Handwriting", f ); return input; } void HandwritingImpl::resetState() { if ( input ) input->resetState(); } QPixmap *HandwritingImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)pen_xpm ); return icn; } QString HandwritingImpl::name() { - // return qApp->translate( "InputMethods", "Handwriting" ); - return "Handwriting"; + return qApp->translate( "InputMethods", "Handwriting" ); } void HandwritingImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( input ) QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT HandwritingImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( HandwritingImpl ) } #endif diff --git a/inputmethods/handwriting/qimpenhelp.cpp b/inputmethods/handwriting/qimpenhelp.cpp index 5ee46a2..a294301 100644 --- a/inputmethods/handwriting/qimpenhelp.cpp +++ b/inputmethods/handwriting/qimpenhelp.cpp @@ -1,52 +1,52 @@ /********************************************************************** -** 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. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "qimpenwidget.h" #include "qimpencombining.h" #include "qimpenmatch.h" #include "qimpenhelp.h" #include <qpe/qpeapplication.h> #include <qpe/global.h> #include <qpe/config.h> #include <qpe/stringutil.h> #include <qtextview.h> #include <qlabel.h> #include <qlistbox.h> #include <qcombobox.h> #include <qpushbutton.h> #include <qlayout.h> #include <qtimer.h> #include <qtextstream.h> /* XPM */ static const char * const left_xpm[] = { "16 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " .. ", " ... ", " .... ", " ..... ", @@ -90,228 +90,229 @@ public: { _code = c; } uint code() const { return _code; } protected: uint _code; }; HandwritingHelp::HandwritingHelp( QIMPenProfile *p, QWidget *parent, const char *name, WFlags f ) : QTabWidget( parent, name, f ) { setCaption( tr("Handwriting Help") ); QTextView *help = new QTextView( this ); help->setFrameStyle( QFrame::NoFrame ); help->setText( tr( "<ul><li>When you start to use the handwriting recogniser " "write slowly, accurately and firmly." "<li>Use the guide lines when drawing your characters." "<li>When drawing a character with multiple strokes, each " "successive stroke must be drawn before the grayed strokes are erased." "<li>Practice your handwriting using the handwriting trainer." "<li>When adding your own character templates make sure they " "are sufficiently different from other characters' templates." "</ul>") ); addTab( help, tr("Tips") ); HandwritingTrainer *trainer = new HandwritingTrainer( p, this ); addTab( trainer, tr("Trainer") ); } void HandwritingHelp::showEvent( QShowEvent * ) { Global::hideInputMethod(); } void HandwritingHelp::hideEvent( QHideEvent * ) { Global::showInputMethod(); } //--------------------------------------------------------------------------- HandwritingTrainer::HandwritingTrainer( QIMPenProfile *p, QWidget *parent, const char *name ) : QWidget( parent, name ), profile(p) { - QGridLayout *gl = new QGridLayout( this, 5, 2, 0, 4 ); - gl->setRowStretch( 1, 1 ); - gl->setRowStretch( 2, 1 ); + QGridLayout *gl = new QGridLayout( this, 4, 2, 0, 4 ); gl->setColStretch( 1, 1 ); + gl->setRowStretch(3, 1); charSetCombo = new QComboBox( this ); gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); QIMPenCharSetIterator it( profile->charSets() ); for ( ; it.current(); ++it ) { charSetCombo->insertItem( it.current()->description() ); } charList = new QListBox( this ); charList->setHScrollBarMode( QListBox::AlwaysOff ); - charList->setFixedWidth( 80 ); + charList->setFixedWidth(80); connect( charList, SIGNAL(highlighted(int)), this, SLOT(selectChar(int)) ); - gl->addMultiCellWidget( charList, 1, 2, 0, 0 ); - - QLabel *help = new QLabel( this ); - help->setAlignment( AlignLeft | AlignVCenter | WordBreak ); - gl->addWidget( help, 1, 1 ); - help->setText( - tr( "Select a character from the list. The writing area on the left " - "shows the reference character. Practice writing in the area on " - "the right.") ); + gl->addWidget(charList, 1, 0); result = new QLabel( this ); - gl->addMultiCellWidget( result, 2, 3, 1, 1 ); + result->setAlignment(AlignLeft | AlignVCenter | WordBreak); + result->setText( + tr( "Select a reference character from the list. Practice writing in " + "the area on the right.")); + gl->addMultiCellWidget(result, 1, 2, 1, 1); matcher = new QIMPenMatch( this ); matcher->setCharSet( currentSet ); connect( matcher, SIGNAL(noMatch()), this, SLOT(noMatch()) ); connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)), this, SLOT(matched(const QIMPenCharMatchList &)) ); QHBoxLayout *hb = new QHBoxLayout(); - gl->addLayout( hb, 3, 0 ); + gl->addLayout( hb, 2, 0 ); prevBtn = new QPushButton( this ); prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); hb->addWidget( prevBtn ); nextBtn = new QPushButton( this ); nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); hb->addWidget( nextBtn ); refPw = new QIMPenWidget( this ); refPw->setReadOnly( TRUE ); - gl->addWidget( refPw, 4, 0 ); + gl->addWidget( refPw, 3, 0 ); pracPw = new QIMPenWidget( this ); connect( matcher, SIGNAL(removeStroke()), pracPw, SLOT(removeStroke()) ); connect( pracPw, SIGNAL(beginStroke()), this, SLOT(beginStroke()) ); connect( pracPw, SIGNAL(stroke( QIMPenStroke * )), this, SLOT(strokeEntered( QIMPenStroke * )) ); connect( pracPw, SIGNAL(beginStroke()), matcher, SLOT(beginStroke()) ); connect( pracPw, SIGNAL(stroke( QIMPenStroke * )), matcher, SLOT(strokeEntered( QIMPenStroke * )) ); - gl->addWidget( pracPw, 4, 1 ); + gl->addWidget( pracPw, 3, 1 ); redrawTimer = new QTimer( this ); connect( redrawTimer, SIGNAL(timeout()), this, SLOT(redrawChar()) ); redrawTimer->start( 5000 ); currentSet = 0; charSetCombo->setCurrentItem( 1 ); selectCharSet( 1 ); } HandwritingTrainer::~HandwritingTrainer() { } void HandwritingTrainer::showEvent( QShowEvent * ) { redrawChar(); redrawTimer->start( 5000 ); } void HandwritingTrainer::setCurrentChar( QIMPenChar *c ) { currentChar = c; refPw->showCharacter( currentChar ); pracPw->clear(); if ( currentChar ) { prevBtn->setEnabled( findPrev() != 0 ); nextBtn->setEnabled( findNext() != 0 ); } - result->setText( "" ); redrawTimer->start( 5000 ); } void HandwritingTrainer::selectChar( int i ) { + static int last_char = 0; + + if (last_char != i) { + result->setText(""); + } + currentChar = 0; currentCode = ((CharListItem *)charList->item(i))->code(); QIMPenCharIterator it(currentSet->characters() ); for ( ; it.current(); ++it ) { if ( it.current()->character() == currentCode && !it.current()->testFlag( QIMPenChar::Deleted ) ) { setCurrentChar( it.current() ); break; } } if ( !it.current() ) setCurrentChar( 0 ); } void HandwritingTrainer::selectCharSet( int i ) { if ( currentSet ) { refPw->removeCharSet( 0 ); pracPw->removeCharSet( 0 ); + result->setText(""); } currentSet = profile->charSets().at( i ); fillCharList(); refPw->insertCharSet( currentSet ); pracPw->insertCharSet( currentSet ); matcher->setCharSet( currentSet ); if ( charList->count() ) { charList->setSelected( 0, TRUE ); selectChar(0); } } void HandwritingTrainer::noMatch() { - result->setText( "No match" ); + result->setText( tr("No match") ); } void HandwritingTrainer::matched( const QIMPenCharMatchList &ml ) { int maxErr = 20000 + (*ml.begin()).penChar->strokeLength(0) * 1000; int baseErr = (*ml.begin()).penChar->strokeLength(0) * 250; unsigned int numStrokes = (*ml.begin()).penChar->strokeCount(); QIMPenCharMatchList::ConstIterator it; /* for ( it = ml.begin(); it != ml.end(); ++it ) { if ( (*it).penChar->strokeCount() == numStrokes ) { if ( (*it).error > maxErr ) maxErr = (*it).error; } } */ int i; QString res; QTextStream ts(&res, IO_WriteOnly); ts << "<qt>" << tr("Matched: "); for ( i = 0, it = ml.begin(); it != ml.end() && i < 4; ++it, i++ ) { if ( (*it).penChar->strokeCount() == numStrokes ) { int rate = 100 - ( ((*it).error - baseErr) * 100 ) / maxErr; if ( it != ml.begin() ) { if ( rate < -10 ) continue; ts << "<br>"; ts << tr("Similar to: "); } ts << "<big>"; if ( (*it).penChar->character() == currentChar->character() ) ts << "<b>"; ts << Qtopia::escapeString((*it).penChar->name()); ts << " (" << rateString(rate) << ")"; if ( (*it).penChar->character() == currentChar->character() ) ts << "</b>"; ts << "</big>"; } } ts << "</qt>"; result->setText( res ); } QString HandwritingTrainer::rateString( int rate ) const { if ( rate < 1 ) rate = 1; if ( rate > 100 ) diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp index 6a21931..3f7a347 100644 --- a/inputmethods/handwriting/qimpeninput.cpp +++ b/inputmethods/handwriting/qimpeninput.cpp @@ -1,52 +1,52 @@ /********************************************************************** -** 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. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "qimpenwidget.h" #include "qimpensetup.h" #include "qimpeninput.h" #include "qimpencombining.h" #include "qimpenwordpick.h" #include "qimpenmatch.h" #include "qimpenhelp.h" #include <qpe/qpeapplication.h> #include <qpe/qdawg.h> #include <qpe/config.h> #include <qpe/global.h> #include <qlayout.h> #include <qpushbutton.h> #include <qlabel.h> #include <qtimer.h> #include <qdir.h> #include <limits.h> // We'll use little pixmaps for the buttons to save screen space. /* XPM */ static const char * const pen_xpm[] = { "12 12 4 1", " c None", ". c #000000", "+ c #FFFFFF", "@ c #808080", " . ", " .+. ", @@ -89,98 +89,98 @@ static char * enter_xpm[] = { "12 12 5 1", " c None", ". c #333333", "+ c #000000", "@ c #FFFFFF", "# c #666666", " ", " .+. ", " +@+ ", " . +@+ ", " ++ +@+ ", " +@#++++@+ ", " +@@@@@@@@+ ", " +@#+++++. ", " ++ ", " . ", " ", " "}; /* XPM */ static char * help_xpm[] = { "12 12 5 1", " c None", ". c #000000", "+ c #FFFFFF", "@ c #666666", "# c #333333", " ", " ... ", " .+++. ", " .+..@+. ", " #.# .+. ", " .+. ", " .+. ", " .+. ", " .+. ", " #.# ", " .+. ", " #.# "}; /*! \class QIMPenInput qimpeninput.h Pen input widget. */ -QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags flags ) - : QFrame( parent, name, flags ), helpDlg(0), profile(0) +QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags f ) + : QFrame( parent, name, f ), helpDlg(0), profile(0) { setFrameStyle( Box | Plain ); profileList.setAutoDelete( true ); matcher = new QIMPenMatch( this ); connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) ); connect( matcher, SIGNAL(erase()), this, SLOT(erase()) ); QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 ); gl->setColStretch( 0, 1 ); wordPicker = new QIMPenWordPick( this ); connect( wordPicker, SIGNAL(wordClicked(const QString &)), this, SLOT(wordPicked(const QString &)) ); connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList &)), this, SLOT(matchedCharacters(const QIMPenCharMatchList &)) ); connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)), wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) ); QFont f("smallsmooth",9); QFontInfo fi( f ); wordPicker->setFont( f ); wordPicker->setBackgroundColor( white ); gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 ); if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) wordPicker->hide(); pw = new QIMPenWidget( this ); gl->addMultiCellWidget( pw, 1, 4, 0, 0 ); int bh = pw->sizeHint().height()/4; QPushButton *b = new QPushButton( this ); b->setFocusPolicy( NoFocus ); b->setPixmap( QPixmap( (const char **)bs_xpm ) ); b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here b->setAutoRepeat( TRUE ); gl->addWidget( b, 1, 1 ); connect( b, SIGNAL(clicked()), SLOT(backspace())); b = new QPushButton( this ); b->setFocusPolicy( NoFocus ); b->setPixmap( QPixmap( (const char **)enter_xpm ) ); b->setFixedHeight(bh); b->setAutoRepeat( TRUE ); gl->addWidget( b, 2, 1 ); connect( b, SIGNAL(clicked()), SLOT(enter())); @@ -193,133 +193,130 @@ QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags flags ) QPixmap pm( (const char **)pen_xpm ); setupBtn = new QPushButton( this ); setupBtn->setFocusPolicy( NoFocus ); setupBtn->setPixmap( pm ); setupBtn->setFixedHeight(bh); gl->addWidget( setupBtn, 4, 1 ); connect( setupBtn, SIGNAL(clicked()), SLOT(setup())); connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) ); connect( pw, SIGNAL(changeCharSet( QIMPenCharSet * )), matcher, SLOT(setCharSet( QIMPenCharSet * )) ); connect( pw, SIGNAL(changeCharSet( int )), this, SLOT(selectCharSet( int )) ); connect( pw, SIGNAL(beginStroke()), matcher, SLOT(beginStroke()) ); connect( pw, SIGNAL(stroke( QIMPenStroke * )), this, SLOT(strokeEntered( QIMPenStroke * )) ); connect( pw, SIGNAL(stroke( QIMPenStroke * )), matcher, SLOT(strokeEntered( QIMPenStroke * )) ); shortcutCharSet = 0; currCharSet = 0; setupDlg = 0; profile = 0; mode = Normal; loadProfiles(); } QIMPenInput::~QIMPenInput() { delete (HandwritingHelp*) helpDlg; } QSize QIMPenInput::sizeHint() const { int fw = frameWidth(); int ps = wordPicker->isHidden() ? 0 : wordPicker->sizeHint().height(); return pw->sizeHint() + QSize( fw*2, fw*2+ps ); } void QIMPenInput::loadProfiles() { profileList.clear(); profile = 0; delete shortcutCharSet; shortcutCharSet = new QIMPenCharSet(); - shortcutCharSet->setTitle( "Shortcut" ); + shortcutCharSet->setTitle( tr("Shortcut") ); QString path = QPEApplication::qpeDir() + "etc/qimpen"; QDir dir( path, "*.conf" ); QStringList list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { QIMPenProfile *p = new QIMPenProfile( path + "/" + *it ); profileList.append( p ); if ( p->shortcut() ) { QIMPenCharIterator it( p->shortcut()->characters() ); for ( ; it.current(); ++it ) { shortcutCharSet->addChar( new QIMPenChar(*it.current()) ); } } } - Config config( "handwriting" ); config.setGroup( "Settings" ); QString prof = config.readEntry( "Profile", "Default" ); selectProfile( prof ); } void QIMPenInput::selectProfile( const QString &name ) { QListIterator<QIMPenProfile> it( profileList ); for ( ; it.current(); ++it ) { if ( it.current()->name() == name ) { profile = it.current(); break; } } - if ( !it.current() ) { - qWarning("No profile selected!\n"); - return; - } + if ( !it.current() ) + return; pw->clearCharSets(); baseSets.clear(); matcher->setMultiStrokeTimeout( profile->multiStrokeTimeout() ); matcher->setWordMatchingEnabled( profile->matchWords() ); if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() ) wordPicker->hide(); else wordPicker->show(); if ( profile->uppercase() && profile->style() == QIMPenProfile::BothCases ) { baseSets.append( profile->uppercase() ); pw->insertCharSet( profile->uppercase() ); } if ( profile->lowercase() ) { baseSets.append( profile->lowercase() ); pw->insertCharSet( profile->lowercase(), profile->style() == QIMPenProfile::BothCases ? 1 : 2 ); } if ( profile->numeric() ) { baseSets.append( profile->numeric() ); pw->insertCharSet( profile->numeric() ); } if ( helpDlg ) delete (HandwritingHelp*) helpDlg; } void QIMPenInput::wordPicked( const QString &w ) { int bs = matcher->word().length(); for ( int i = 0; i < bs; i++ ) keypress( Qt::Key_Backspace << 16 ); for ( unsigned int i = 0; i < w.length(); i++ ) keypress( w[i].unicode() ); matcher->resetState(); wordPicker->clear(); } void QIMPenInput::selectCharSet( int idx ) { if ( mode == Switch ) { //qDebug( "Switch back to normal" ); diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp index 4b5bb83..3b1b5e9 100644 --- a/inputmethods/handwriting/qimpenprofile.cpp +++ b/inputmethods/handwriting/qimpenprofile.cpp @@ -1,145 +1,145 @@ /********************************************************************** -** 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. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "qimpencombining.h" #include "qimpenprofile.h" #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/global.h> QIMPenProfile::QIMPenProfile( const QString &fn ) : filename( fn ) { sets.setAutoDelete( true ); Config config( filename, Config::File ); config.setGroup( "Handwriting" ); pname = config.readEntry( "Name" ); pdesc = config.readEntry( "Description" ); tstyle = config.readBoolEntry( "CanSelectStyle", false ); wordMatch = config.readBoolEntry( "MatchWords", true ); config.setGroup( "Settings" ); pstyle = BothCases; QString s = config.readEntry( "Style", "BothCases" ); if ( s == "ToggleCases" ) pstyle = ToggleCases; msTimeout = config.readNumEntry( "MultiTimeout", 500 ); // Read user configuration Config usrConfig( userConfig() ); usrConfig.setGroup( "Settings" ); msTimeout = usrConfig.readNumEntry( "MultiTimeout", msTimeout ); if ( tstyle && usrConfig.hasKey( "Style" ) ) { pstyle = BothCases; QString s = usrConfig.readEntry( "Style", "BothCases" ); if ( s == "ToggleCases" ) pstyle = ToggleCases; } } void QIMPenProfile::setStyle( Style s ) { if ( tstyle && s != pstyle ) { pstyle = s; Config config( userConfig() ); config.setGroup( "Settings" ); QString s = pstyle == ToggleCases ? "ToggleCases" : "BothCases"; config.writeEntry( "Style", s ); } } void QIMPenProfile::setMultiStrokeTimeout( int t ) { if ( t != msTimeout ) { msTimeout = t; Config config( userConfig() ); config.setGroup( "Settings" ); config.writeEntry( "MultiTimeout", msTimeout ); } } QString QIMPenProfile::userConfig() { QString un = filename; int pos = un.findRev( '/' ); if ( pos >= 0 ) un = un.mid( pos + 1 ); pos = un.find( '.' ); if ( pos > 0 ) un.truncate( pos ); - un = "handwriting-" + un; + un = "handwriting-" + un; // No tr return un; } void QIMPenProfile::loadData() { Config config( filename, Config::File ); config.setGroup( "CharSets" ); QString baseDir = QPEApplication::qpeDir(); baseDir += "/etc/"; // accents QIMPenCombining *combining = 0; QString s = config.readEntry( "Combining" ); if ( !s.isEmpty() ) { combining = new QIMPenCombining( baseDir + "qimpen/" + s ); if ( combining->isEmpty() ) { delete combining; combining = 0; } } // uppercase latin1 QIMPenCharSet *cs = 0; s = config.readEntry( "Uppercase" ); if ( !s.isEmpty() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { if ( combining ) combining->addCombined( cs ); sets.append( cs ); } else { delete cs; } } // lowercase latin1 s = config.readEntry( "Lowercase" ); if ( !s.isEmpty() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { if ( combining ) combining->addCombined( cs ); sets.append( cs ); } else { delete cs; } } diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp index 2c06fbc..5d49e03 100644 --- a/inputmethods/handwriting/qimpensetup.cpp +++ b/inputmethods/handwriting/qimpensetup.cpp @@ -1,52 +1,52 @@ /********************************************************************** -** 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. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "qimpenwidget.h" #include "qimpenprefbase.h" #include "qimpensetup.h" #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qcombobox.h> #include <qlistbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlayout.h> #include <qpixmap.h> #include <qbuttongroup.h> #include <qslider.h> #include <qtabwidget.h> #include <qdir.h> #include <qmessagebox.h> /* XPM */ static const char * const left_xpm[] = { "16 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " .. ", " ... ", " .... ", @@ -190,97 +190,97 @@ void QIMPenSetup::accept() // Save current profile if ( profileCombo ) { Config config( "handwriting" ); config.setGroup( "Settings" ); config.writeEntry( "Profile", profileCombo->currentText() ); } // Save charsets bool ok = TRUE; for ( int i = 0; i < (int)profileList.count(); i++ ) { QIMPenProfile *prof = profileList.at(i); QIMPenCharSetIterator it(prof->charSets()); for ( ; it.current(); ++it ) { if ( !(it.current()->save( QIMPenCharSet::User )) ) { ok = FALSE; break; } } } if ( !ok ) { if ( QMessageBox::critical( 0, tr( "Out of space" ), tr("Unable to save information.\n" "Free up some space\n" "and try again.\n" "\nQuit anyway?"), QMessageBox::Yes|QMessageBox::Escape, QMessageBox::No|QMessageBox::Default ) != QMessageBox::No ) { QDialog::accept(); } } else { QDialog::accept(); } } //--------------------------------------------------------------------------- QIMPenInputCharDlg::QIMPenInputCharDlg( QWidget *parent, const char *name, bool modal, int WFlags) : QDialog( parent, name, modal, WFlags ) { setCaption( tr("Enter new character") ); uni = 0; QVBoxLayout *vb = new QVBoxLayout( this, 10 ); QHBoxLayout *hb = new QHBoxLayout(); vb->addLayout( hb ); - QLabel *label = new QLabel( "Character:", this ); + QLabel *label = new QLabel( tr("Character:"), this ); hb->addWidget( label ); QComboBox *cb = new QComboBox( TRUE, this ); connect( cb, SIGNAL(activated(int)), SLOT(setSpecial(int)) ); connect( cb, SIGNAL(textChanged(const QString &)), SLOT(setCharacter(const QString &)) ); addSpecial( cb ); cb->setEditText( "" ); hb->addWidget( cb ); hb = new QHBoxLayout(); vb->addLayout( hb ); QPushButton *pb = new QPushButton( "OK", this ); connect( pb, SIGNAL(clicked()), SLOT(accept())); hb->addWidget( pb ); pb = new QPushButton( "Cancel", this ); connect( pb, SIGNAL(clicked()), SLOT(reject())); hb->addWidget( pb ); cb->setFocus(); } void QIMPenInputCharDlg::addSpecial( QComboBox *cb ) { int i = 0; while ( qimpen_specialKeys[i].code != Key_unknown ) { cb->insertItem( qimpen_specialKeys[i].name ); i++; } } void QIMPenInputCharDlg::setSpecial( int sp ) { uni = qimpen_specialKeys[sp].code << 16; } void QIMPenInputCharDlg::setCharacter( const QString &string ) { uni = string[0].unicode(); } //--------------------------------------------------------------------------- class CharListItem : public QListBoxText { public: CharListItem( const QString &text, uint c ) @@ -328,101 +328,101 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, charList = new QListBox( this ); charList->setMinimumHeight( charList->sizeHint().height() ); connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); gl->addWidget( charList, 1, 0 ); pw = new QIMPenWidget( this ); pw->setFixedHeight( 75 ); gl->addMultiCellWidget( pw, 2, 3, 0, 0 ); connect( pw, SIGNAL(stroke(QIMPenStroke *)), SLOT(newStroke(QIMPenStroke *)) ); QVBoxLayout *vb = new QVBoxLayout(); gl->addLayout( vb, 1, 1 ); newBtn = new QPushButton( tr("New..."), this ); connect( newBtn, SIGNAL(clicked()), SLOT(addNewChar()) ); vb->addWidget( newBtn ); addBtn = new QPushButton( tr("Add"), this ); connect( addBtn, SIGNAL(clicked()), SLOT(addChar()) ); vb->addWidget( addBtn ); removeBtn = new QPushButton( tr("Remove"), this ); connect( removeBtn, SIGNAL(clicked()), SLOT(removeChar()) ); vb->addWidget( removeBtn ); QPushButton *pb = new QPushButton( tr("Default"), this ); connect( pb, SIGNAL(clicked()), SLOT(defaultChars()) ); vb->addWidget( pb ); QHBoxLayout *hb = new QHBoxLayout(); gl->addLayout( hb, 2, 1 ); prevBtn = new QPushButton( this ); prevBtn->setPixmap( QPixmap( (const char **)left_xpm ) ); connect( prevBtn, SIGNAL(clicked()), SLOT(prevChar())); hb->addWidget( prevBtn ); nextBtn = new QPushButton( this ); nextBtn->setPixmap( QPixmap( (const char **)right_xpm ) ); connect( nextBtn, SIGNAL(clicked()), SLOT(nextChar())); hb->addWidget( nextBtn ); pb = new QPushButton( tr("Clear"), this ); connect( pb, SIGNAL(clicked()), SLOT(clearChar()) ); gl->addWidget( pb, 3, 1 ); //-- #if !defined(Q_WS_QWS) hb = new QHBoxLayout( tvb ); - pb = new QPushButton( "OK", this ); + pb = new QPushButton( tr("OK"), this ); connect( pb, SIGNAL(clicked()), SLOT(accept()) ); hb->addWidget( pb ); - pb = new QPushButton( "Cancel", this ); + pb = new QPushButton( tr("Cancel"), this ); connect( pb, SIGNAL(clicked()), SLOT(reject()) ); hb->addWidget( pb ); #endif selectCharSet( 0 ); charList->setFocus(); resize( minimumSize() ); enableButtons(); } void QIMPenEdit::setProfile( QIMPenProfile *p ) { profile = p; charSetCombo->clear(); QIMPenCharSetIterator it( profile->charSets() ); for ( ; it.current(); ++it ) { charSetCombo->insertItem( it.current()->description() ); } selectCharSet( 0 ); charList->setFocus(); enableButtons(); } void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) { int i = 0; QIMPenCharSetIterator it( profile->charSets() ); for ( ; it.current(); ++it, i++ ) { if ( it.current() == c ) { charSetCombo->setCurrentItem( i ); selectCharSet( i ); } } } /*! Fill the character list box with the characters. Duplicates are not inserted. */ void QIMPenEdit::fillCharList() { charList->clear(); QIMPenCharIterator it( currentSet->characters() ); CharListItem *li = 0; for ( ; it.current(); ++it ) { uint ch = it.current()->character(); QString n = it.current()->name(); diff --git a/inputmethods/jumpx/keyboardimpl.cpp b/inputmethods/jumpx/keyboardimpl.cpp index 004f0b0..92abb09 100644 --- a/inputmethods/jumpx/keyboardimpl.cpp +++ b/inputmethods/jumpx/keyboardimpl.cpp @@ -22,77 +22,76 @@ static const char * icon_xpm[] = { " ... ... ... ... ... ... ", ". . . . . . . ", ". . . . . . . ", ". . . . . . . ", " ....... ... ... ....... ", ". . . . . ", ". . . . . ", ". . . . . ", " ....... ... ... ....... ", ". . . . . . . ", ". . . . . . . ", ". . . . . . . ", " ... ... ... ... ... ... "}; KeyboardImpl::KeyboardImpl() : input(0), icn(0), ref(0) { } KeyboardImpl::~KeyboardImpl() { delete input; delete icn; } QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !input ) input = new Keyboard( parent, "Keyboard", f ); return input; } void KeyboardImpl::resetState() { if ( input ) input->resetState(); } QPixmap *KeyboardImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)icon_xpm ); return icn; } QString KeyboardImpl::name() { - // return qApp->translate( "InputMethods", "JumpX" ); - return "JumpX"; + return qApp->translate( "InputMethods", "JumpX" ); } void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( input ) QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( KeyboardImpl ) } #endif diff --git a/inputmethods/keyboard/keyboardimpl.cpp b/inputmethods/keyboard/keyboardimpl.cpp index 56e6870..bc96402 100644 --- a/inputmethods/keyboard/keyboardimpl.cpp +++ b/inputmethods/keyboard/keyboardimpl.cpp @@ -55,77 +55,76 @@ static char * opti_xpm[] = { " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... ", " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... ", " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... ", " .+++.+++.+++.+++.+++.+++. ", " .+@@.+@@.+@@.+@@.+@@.+@@. ", " ......................... "}; KeyboardImpl::KeyboardImpl() : input(0), icn(0), ref(0) { } KeyboardImpl::~KeyboardImpl() { delete input; delete icn; } QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !input ) input = new Keyboard( parent, "Keyboard", f ); return input; } void KeyboardImpl::resetState() { if ( input ) input->resetState(); } QPixmap *KeyboardImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)kb_xpm ); return icn; } QString KeyboardImpl::name() { - // return qApp->translate( "InputMethods", "Keyboard" ); - return "Keyboard"; + return qApp->translate( "InputMethods", "Keyboard" ); } void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( input ) QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( KeyboardImpl ) } #endif diff --git a/inputmethods/kjumpx/keyboardimpl.cpp b/inputmethods/kjumpx/keyboardimpl.cpp index dbae2b4..5d8e0d3 100644 --- a/inputmethods/kjumpx/keyboardimpl.cpp +++ b/inputmethods/kjumpx/keyboardimpl.cpp @@ -22,77 +22,76 @@ static char * icon_xpm[] = { " ... ... ... ... ... ... ", ". . . . . ", ". . ... .. . . ", ". . .. . . ", " ...... ...... ... .... ", ". .. .. .. . ", ". .. .. .. . ", ". ... .. . ", " ...... .. ...... ", ". . .. . . ", ". . ....... . . ", ". . . . . ", " ... ... ... ... ... ... "}; KeyboardImpl::KeyboardImpl() : input(0), icn(0), ref(0) { } KeyboardImpl::~KeyboardImpl() { delete input; delete icn; } QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !input ) input = new Keyboard( parent, "Keyboard", f ); return input; } void KeyboardImpl::resetState() { if ( input ) input->resetState(); } QPixmap *KeyboardImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)icon_xpm ); return icn; } QString KeyboardImpl::name() { - // return qApp->translate( "InputMethods", "KJumpX" ); - return "KJumpX"; + return qApp->translate( "InputMethods", "KJumpX" ); } void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( input ) QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( KeyboardImpl ) } #endif diff --git a/inputmethods/pickboard/pickboardimpl.cpp b/inputmethods/pickboard/pickboardimpl.cpp index 617acff..a4e8f02 100644 --- a/inputmethods/pickboard/pickboardimpl.cpp +++ b/inputmethods/pickboard/pickboardimpl.cpp @@ -25,78 +25,77 @@ /* XPM */ static const char * pb_xpm[]={ "28 7 2 1", "# c #303030", " c None", " ########################## ", " # # # # # # # ", " # # # # # # # ", " ########################## ", " # # # # # # ", " # # # # # # ", " ########################## "}; PickboardImpl::PickboardImpl() : pickboard(0), icn(0), ref(0) { } PickboardImpl::~PickboardImpl() { delete pickboard; delete icn; } QWidget *PickboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !pickboard ) pickboard = new Pickboard( parent, "pickboard", f ); return pickboard; } void PickboardImpl::resetState() { if ( pickboard ) pickboard->resetState(); } QPixmap *PickboardImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)pb_xpm ); return icn; } QString PickboardImpl::name() { - // return qApp->translate( "InputMethods", "Pickboard" ); - return "Pickboard"; + return qApp->translate( "InputMethods", "Pickboard" ); } void PickboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( pickboard ) QObject::connect( pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } #ifndef QT_NO_COMPONENT QRESULT PickboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( PickboardImpl ) } #endif diff --git a/inputmethods/unikeyboard/unikeyboardimpl.cpp b/inputmethods/unikeyboard/unikeyboardimpl.cpp index aa05b31..fe601e0 100644 --- a/inputmethods/unikeyboard/unikeyboardimpl.cpp +++ b/inputmethods/unikeyboard/unikeyboardimpl.cpp @@ -30,77 +30,76 @@ static const char * uni_xpm[]={ ". c None", "............................", "...####....#####.....####...", "...####....######....####...", "...####....#######..........", "...####....########..####...", "...####....####.####.####...", "...####....####..########...", "...####....####...#######...", "...####....####....######...", "...#####..#####.....#####...", "....##########.......####...", "......######..........###...", "............................"}; UniKeyboardImpl::UniKeyboardImpl() : input(0), icn(0), ref(0) { } UniKeyboardImpl::~UniKeyboardImpl() { delete input; delete icn; } QWidget *UniKeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) { if ( !input ) input = new UniKeyboard( parent, "UniKeyboard", f ); return input; } void UniKeyboardImpl::resetState() { if ( input ) input->resetState(); } QPixmap *UniKeyboardImpl::icon() { if ( !icn ) icn = new QPixmap( (const char **)uni_xpm ); return icn; } QString UniKeyboardImpl::name() { - // return qApp->translate( "InputMethods", "Unicode" ); - return "Unicode"; + return qApp->translate( "InputMethods", "Unicode" ); } void UniKeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) { if ( input ) QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); } QRESULT UniKeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_InputMethod ) *iface = this; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( UniKeyboardImpl ) } |