author | zecke <zecke> | 2004-01-18 13:26:43 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-01-18 13:26:43 (UTC) |
commit | 7d94c9b04f8702d0f94c6c64454d159a186a2576 (patch) (side-by-side diff) | |
tree | a5989f07e02e610abab7cf7514737a67c78b1d68 /inputmethods/handwriting/qimpenprofile.cpp | |
parent | a2a3aabf21655cc9c7df8e2ed0d420d2b208fd3d (diff) | |
download | opie-7d94c9b04f8702d0f94c6c64454d159a186a2576.zip opie-7d94c9b04f8702d0f94c6c64454d159a186a2576.tar.gz opie-7d94c9b04f8702d0f94c6c64454d159a186a2576.tar.bz2 |
Comit the "Mono" patch by
Brad Campbell <brad@wasp.net.au>
Diffstat (limited to 'inputmethods/handwriting/qimpenprofile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/handwriting/qimpenprofile.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp index 3b1b5e9..b1a6592 100644 --- a/inputmethods/handwriting/qimpenprofile.cpp +++ b/inputmethods/handwriting/qimpenprofile.cpp @@ -3,181 +3,204 @@ ** ** 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; + QString t = config.readEntry( "Mono", "Dual" ); + pmono = (QString::fromLatin1("Mono") == t ); + 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; // 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() ) { + if ( !s.isEmpty() && !mono() ) { 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() ) { + 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->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 ( 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 ); if ( !cs->isEmpty() ) { sets.append( cs ); } else { delete cs; } } // punctuation s = config.readEntry( "Punctuation" ); if ( !s.isEmpty() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { sets.append( cs ); } else { delete cs; } } // symbol s = config.readEntry( "Symbol" ); if ( !s.isEmpty() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); if ( !cs->isEmpty() ) { sets.append( cs ); } else { delete cs; } } // shortcut s = config.readEntry( "Shortcut" ); if ( !s.isEmpty() ) { cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); |