author | zecke <zecke> | 2002-11-03 11:10:04 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-03 11:10:04 (UTC) |
commit | eac6c5d3a22147d78866122c2f5b89d3fdf6bfc6 (patch) (side-by-side diff) | |
tree | d096190896794e21fd2194a8ff17edec61b2c64f | |
parent | 3176ef8fcbaa4716738df7d2e4c0216ccaab604a (diff) | |
download | opie-eac6c5d3a22147d78866122c2f5b89d3fdf6bfc6.zip opie-eac6c5d3a22147d78866122c2f5b89d3fdf6bfc6.tar.gz opie-eac6c5d3a22147d78866122c2f5b89d3fdf6bfc6.tar.bz2 |
No default arguments....
Patch by jowenn
-rw-r--r-- | inputmethods/handwriting/qimpeninput.cpp | 4 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpeninput.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp index 3f7a347..db33c9b 100644 --- a/inputmethods/handwriting/qimpeninput.cpp +++ b/inputmethods/handwriting/qimpeninput.cpp @@ -1,330 +1,330 @@ /********************************************************************** ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** ** 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", " . ", " .+. ", " ..@@.", " .+@.. ", " .+@@. ", " .+@@. ", " .+@@. ", " .@.@. ", " .@@. ", " .... ", " .. ", " "}; /* XPM */ static char * bs_xpm[] = { "12 12 5 1", " c None", ". c #333333", "+ c #000000", "@ c #FFFFFF", "# c #666666", " ", " ", " ", " . ", " ++ ", " +@#+++++. ", " +@@@@@@@@+ ", " +@#+++++. ", " ++ ", " . ", " ", " "}; /* XPM */ 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 f ) - : QFrame( parent, name, f ), helpDlg(0), profile(0) +QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags wf ) + : QFrame( parent, name, wf ), 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())); helpBtn = new QPushButton( this ); helpBtn->setFocusPolicy( NoFocus ); helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) ); helpBtn->setFixedHeight(bh); gl->addWidget( helpBtn, 3, 1 ); connect( helpBtn, SIGNAL(clicked()), SLOT(help())); 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( 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() ) 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" ); pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); mode = Normal; } currCharSet = idx; } void QIMPenInput::beginStroke() { diff --git a/inputmethods/handwriting/qimpeninput.h b/inputmethods/handwriting/qimpeninput.h index b4e4006..75cf260 100644 --- a/inputmethods/handwriting/qimpeninput.h +++ b/inputmethods/handwriting/qimpeninput.h @@ -1,94 +1,94 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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. ** **********************************************************************/ #ifndef _QIMPENINPUT_H_ #define _QIMPENINPUT_H_ #include "qimpenprofile.h" #include <qpe/qdawg.h> #include <qframe.h> #include <qlist.h> #include <qguardedptr.h> class QPushButton; class QTimer; class QIMPenWidget; class QIMPenSetup; class QIMPenWordPick; class QIMPenMatch; class HandwritingHelp; class QIMPenInput : public QFrame { Q_OBJECT public: - QIMPenInput( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); + QIMPenInput( QWidget *parent = 0, const char *name = 0, WFlags wf = 0 ); virtual ~QIMPenInput(); void resetState(); QSize sizeHint() const; signals: void key( ushort, ushort, ushort, bool, bool ); private slots: void wordPicked( const QString & ); void selectCharSet( int ); void beginStroke(); void strokeEntered( QIMPenStroke *st ); void matchedCharacters( const QIMPenCharMatchList &cl ); void keypress( uint scan_uni ); void erase(); void help(); void setup(); void backspace(); void enter(); private: void loadProfiles(); void selectProfile( const QString &name ); void handleExtended( const QString & ); void updateWordMatch( QIMPenCharMatchList &ml ); void matchWords(); void scanDict( const QDawg::Node* n, int ipos, const QString& str, int error ); enum Mode { Normal, Switch, SwitchLock }; private: Mode mode; QRect prefRect; QIMPenWidget *pw; QPushButton *helpBtn; QPushButton *setupBtn; QIMPenSetup *setupDlg; QIMPenMatch *matcher; QGuardedPtr<HandwritingHelp> helpDlg; QIMPenProfile *profile; QList<QIMPenProfile> profileList; QIMPenCharSet *shortcutCharSet; QIMPenCharSetList baseSets; int currCharSet; QIMPenWordPick *wordPicker; }; #endif // _QIMPENINPUT_H_ |