author | brad <brad> | 2004-07-03 07:07:40 (UTC) |
---|---|---|
committer | brad <brad> | 2004-07-03 07:07:40 (UTC) |
commit | 88c9b1b2bbc64bae352eb7ddb7eabf9fbaca416d (patch) (side-by-side diff) | |
tree | b2f5bf2b2bf4ab8638708c6e2228e6c3f9fe83e7 /inputmethods/handwriting/qimpenhelp.cpp | |
parent | 0b0cc8ff22fdae62b8f40dc2a77a4de9a6fd0cb6 (diff) | |
download | opie-88c9b1b2bbc64bae352eb7ddb7eabf9fbaca416d.zip opie-88c9b1b2bbc64bae352eb7ddb7eabf9fbaca416d.tar.gz opie-88c9b1b2bbc64bae352eb7ddb7eabf9fbaca416d.tar.bz2 |
Don't display hidden sets in trainer.
Diffstat (limited to 'inputmethods/handwriting/qimpenhelp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/handwriting/qimpenhelp.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/inputmethods/handwriting/qimpenhelp.cpp b/inputmethods/handwriting/qimpenhelp.cpp index 0727931..d0ccd55 100644 --- a/inputmethods/handwriting/qimpenhelp.cpp +++ b/inputmethods/handwriting/qimpenhelp.cpp @@ -51,193 +51,194 @@ static const char * const left_xpm[] = { " .... ", " ..... ", " ...... ", " ..... ", " .... ", " ... ", " .. ", " . ", " ", " "}; /* XPM */ static const char * const right_xpm[] = { "16 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " .. ", " ... ", " .... ", " ..... ", " ...... ", " ..... ", " .... ", " ... ", " .. ", " . ", " ", " "}; class CharListItem : public QListBoxText { public: CharListItem( const QString &text, uint c ) : QListBoxText( text ) { _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, 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() ); + if ( ! it.current()->hidden() ) + charSetCombo->insertItem( it.current()->description() ); } charList = new QListBox( this ); charList->setHScrollBarMode( QListBox::AlwaysOff ); charList->setFixedWidth(80); connect( charList, SIGNAL(highlighted(int)), this, SLOT(selectChar(int)) ); gl->addWidget(charList, 1, 0); result = new QLabel( this ); 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, 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, 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, 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 ); } 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; |