author | brad <brad> | 2004-03-21 12:42:10 (UTC) |
---|---|---|
committer | brad <brad> | 2004-03-21 12:42:10 (UTC) |
commit | de722623b49574659f6ef5b065076cb1609f81dd (patch) (side-by-side diff) | |
tree | 0d2ca78cfe42c71787a3e160b245285e18d900d3 /inputmethods | |
parent | 2560326d09f90f0afce24577cafbfd4c1f5e4b23 (diff) | |
download | opie-de722623b49574659f6ef5b065076cb1609f81dd.zip opie-de722623b49574659f6ef5b065076cb1609f81dd.tar.gz opie-de722623b49574659f6ef5b065076cb1609f81dd.tar.bz2 |
Fixes for graffiti handling. Contains a dirty hack that will be rectified when I commit the Graffiti charset.
-rw-r--r-- | inputmethods/handwriting/qimpenchar.h | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenprofile.cpp | 3 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.cpp | 17 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.h | 1 |
4 files changed, 19 insertions, 4 deletions
diff --git a/inputmethods/handwriting/qimpenchar.h b/inputmethods/handwriting/qimpenchar.h index e4e7645..92ee2c1 100644 --- a/inputmethods/handwriting/qimpenchar.h +++ b/inputmethods/handwriting/qimpenchar.h @@ -108,25 +108,25 @@ public: unsigned int count() const { return chars.count(); } void clear() { chars.clear(); } void setDescription( const QString &d ) { desc = d; } QString description() const { return desc; } void setTitle( const QString &t ) { csTitle = t; } QString title() const { return csTitle; } QIMPenCharMatchList match( QIMPenChar *ch ); void addChar( QIMPenChar *ch ); void removeChar( QIMPenChar *ch ); QIMPenChar *at( int i ); - void setHidden ( const bool &b ) { phidden = &b; } + void setHidden ( const bool &b ) { phidden = b; } bool hidden() const { return phidden; } unsigned maximumStrokes() const { return maxStrokes; } void up( QIMPenChar *ch ); void down( QIMPenChar *ch ); enum Domain { System, User }; enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 }; const QIMPenCharList &characters() const { return chars; } diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp index b1a6592..67343c3 100644 --- a/inputmethods/handwriting/qimpenprofile.cpp +++ b/inputmethods/handwriting/qimpenprofile.cpp @@ -133,41 +133,44 @@ void QIMPenProfile::loadData() delete cs; } } // lowercase latin1 s = config.readEntry( "Lowercase" ); if ( !s.isEmpty() ) { if ( mono() ) { cs = new QIMPenCharSet ( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { cs->setTitle( cs->title().upper() ); cs->setType( QIMPenCharSet::Upper ); + cs->setDescription( "Hidden uppercase" ); cs->setHidden ( true ); QIMPenCharIterator it( cs->characters() ); for ( ; it.current(); ++it ) { uint ch = it.current()->character(); if ( ch >= 'a' && ch <= 'z' ) it.current()->setCharacter( QChar(ch).upper() ); } if ( combining ) combining->addCombined( cs ); sets.append( cs ); } else { delete cs; } } cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { + if ( mono () ) + cs->setDescription( "Latin Characters" ); if ( combining ) combining->addCombined( cs ); sets.append( cs ); } else { delete cs; } } // numeric (may comtain punctuation and symbols) s = config.readEntry( "Numeric" ); if ( !s.isEmpty() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp index d1297a9..3f4841d 100644 --- a/inputmethods/handwriting/qimpensetup.cpp +++ b/inputmethods/handwriting/qimpensetup.cpp @@ -317,25 +317,25 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, currentCode = 0; inputChar = new QIMPenChar(); QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); gl->setRowStretch( 1, 1 ); gl->addRowSpacing( 2, 35 ); gl->addRowSpacing( 3, 35 ); charSetCombo = new QComboBox( this ); gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); - connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); + connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSetVisible(int))); QIMPenCharSetIterator it( profile->charSets() ); for ( ; it.current(); ++it ) { charSetCombo->insertItem( it.current()->description() ); } 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 ); @@ -379,41 +379,41 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent, //-- #if !defined(Q_WS_QWS) hb = new QHBoxLayout( tvb ); pb = new QPushButton( tr("OK"), this ); connect( pb, SIGNAL(clicked()), SLOT(accept()) ); hb->addWidget( pb ); pb = new QPushButton( tr("Cancel"), this ); connect( pb, SIGNAL(clicked()), SLOT(reject()) ); hb->addWidget( pb ); #endif - selectCharSet( 0 ); + selectCharSetVisible( 0 ); charList->setFocus(); resize( minimumSize() ); enableButtons(); } void QIMPenEdit::setProfile( QIMPenProfile *p ) { profile = p; charSetCombo->clear(); QIMPenCharSetIterator it( profile->charSets() ); for ( ; it.current(); ++it ) { if ( ! it.current()->hidden() ) charSetCombo->insertItem( it.current()->description() ); } - selectCharSet( 0 ); + selectCharSetVisible( 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 ); @@ -540,24 +540,35 @@ void QIMPenEdit::selectChar( int i ) for ( ; it.current(); ++it ) { if ( it.current()->character() == currentCode && !it.current()->testFlag( QIMPenChar::Deleted ) ) { setCurrentChar( it.current() ); break; } } if ( !it.current() ) setCurrentChar( 0 ); inputChar->clear(); } +void QIMPenEdit::selectCharSetVisible( int c ) +{ + int i = 0; + QIMPenCharSetIterator it( profile->charSets() ); + for ( ; it.current(); ++it, i++ ) { + if ( charSetCombo->text( c ) == it.current()->description() ) { + selectCharSet( i ); + } + } +} + void QIMPenEdit::selectCharSet( int i ) { if ( currentSet ) pw->removeCharSet( 0 ); currentSet = profile->charSets().at( i ); fillCharList(); pw->insertCharSet( currentSet ); inputChar->clear(); if ( charList->count() ) { charList->setSelected( 0, TRUE ); selectChar(0); } diff --git a/inputmethods/handwriting/qimpensetup.h b/inputmethods/handwriting/qimpensetup.h index 5d3064b..93b981b 100644 --- a/inputmethods/handwriting/qimpensetup.h +++ b/inputmethods/handwriting/qimpensetup.h @@ -91,24 +91,25 @@ protected: void fillCharList(); void enableButtons(); QIMPenChar *findPrev(); QIMPenChar *findNext(); void setCurrentChar( QIMPenChar * ); protected slots: void prevChar(); void nextChar(); void clearChar(); void selectChar( int ); void selectCharSet( int ); + void selectCharSetVisible( int ); void addChar(); void addNewChar(); void removeChar(); void defaultChars(); void newStroke( QIMPenStroke * ); protected: QIMPenWidget *pw; QComboBox *charSetCombo; QListBox *charList; QPushButton *newBtn; QPushButton *addBtn; |