-rw-r--r-- | inputmethods/handwriting/config.in | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/handwriting.pro | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenchar.cpp | 4 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpensetup.cpp | 3 |
4 files changed, 6 insertions, 5 deletions
diff --git a/inputmethods/handwriting/config.in b/inputmethods/handwriting/config.in index 3a5fddb..b4acc9a 100644 --- a/inputmethods/handwriting/config.in +++ b/inputmethods/handwriting/config.in @@ -1,8 +1,8 @@ config HANDWRITING boolean "opie-handwriting (Handwriting recognition)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE comment "opie-handwriting-classicset automatically selected" depends HANDWRITING comment "opie-handwriting-graffitiset automatically selected" depends HANDWRITING diff --git a/inputmethods/handwriting/handwriting.pro b/inputmethods/handwriting/handwriting.pro index 3800381..e6f3b3f 100644 --- a/inputmethods/handwriting/handwriting.pro +++ b/inputmethods/handwriting/handwriting.pro @@ -1,34 +1,34 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release HEADERS = qimpenchar.h \ qimpenprofile.h \ qimpencombining.h \ qimpenhelp.h \ qimpeninput.h \ qimpenmatch.h \ qimpensetup.h \ qimpenstroke.h \ qimpenwidget.h \ qimpenwordpick.h \ handwritingimpl.h SOURCES = qimpenchar.cpp \ qimpenprofile.cpp \ qimpencombining.cpp \ qimpenhelp.cpp \ qimpeninput.cpp \ qimpenmatch.cpp \ qimpensetup.cpp \ qimpenstroke.cpp \ qimpenwidget.cpp \ qimpenwordpick.cpp \ handwritingimpl.cpp INTERFACES = qimpenprefbase.ui TARGET = qhandwriting DESTDIR = ../../plugins/inputmethods INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include ../../launcher -LIBS += -lqpe +LIBS += -lqpe -lopiecore2 VERSION = 1.0.0 include ( $(OPIEDIR)/include.pro ) target.path = $$prefix/plugins/inputmethods diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp index db5d135..b83b2a4 100644 --- a/inputmethods/handwriting/qimpenchar.cpp +++ b/inputmethods/handwriting/qimpenchar.cpp @@ -347,98 +347,98 @@ bool QIMPenCharSet::load( const QString &fn, Domain d ) if ( file.status() == IO_Ok ) ok = TRUE; } setHidden ( false ); return ok; } /*! Save this character set. */ bool QIMPenCharSet::save( Domain d ) { if ( filename( d ).isEmpty() ) return FALSE; if ( hidden() ) return TRUE; bool ok = FALSE; QString fn = filename( d ); QString tmpFn = fn + ".new"; QFile file( tmpFn ); if ( file.open( IO_WriteOnly|IO_Raw ) ) { QByteArray buf; QDataStream ds( buf, IO_WriteOnly ); ds << QString( "QPT 1.1" ); ds << csTitle; ds << desc; ds << (Q_INT8)csType; QIMPenCharIterator ci( chars ); for ( ; ci.current(); ++ci ) { QIMPenChar *pc = ci.current(); if ( ( ( (d == System) && pc->testFlag( QIMPenChar::System ) ) || ( (d == User) && !pc->testFlag( QIMPenChar::System ) ) ) && ( !pc->testFlag (QIMPenChar::Combined ) ) ) { ds << *pc; } } file.writeBlock( buf ); file.close(); if ( file.status() == IO_Ok ) ok = TRUE; } if ( ok ) { if ( ::rename( tmpFn.latin1(), fn.latin1() ) < 0 ) { - qWarning( "problem renaming file %s to %s, errno: %d", - tmpFn.latin1(), fn.latin1(), errno ); + owarn << "problem renaming file " <<tmpFn.latin1() << " to "<< fn.latin1() + << ", errno: " << errno << oendl; // remove the tmp file, otherwise, it will just lay around... QFile::remove( tmpFn.latin1() ); ok = FALSE; } } return ok; } QIMPenChar *QIMPenCharSet::at( int i ) { return chars.at(i); } void QIMPenCharSet::markDeleted( uint ch ) { QIMPenCharIterator ci( chars ); for ( ; ci.current(); ++ci ) { QIMPenChar *pc = ci.current(); if ( pc->character() == ch && pc->testFlag( QIMPenChar::System ) ) pc->setFlag( QIMPenChar::Deleted ); } } /*! Find the best matches for \a ch in this character set. */ QIMPenCharMatchList QIMPenCharSet::match( QIMPenChar *ch ) { QIMPenCharMatchList matches; QIMPenCharIterator ci( chars ); for ( ; ci.current(); ++ci ) { QIMPenChar *tmplChar = ci.current(); if ( tmplChar->testFlag( QIMPenChar::Deleted ) ) { continue; } int err; if ( ch->penStrokes().count() <= tmplChar->penStrokes().count() ) { err = ch->match( tmplChar ); if ( err <= QIMPEN_MATCH_THRESHOLD ) { if (tmplChar->penStrokes().count() != ch->penStrokes().count()) err = QMIN(err*3, QIMPEN_MATCH_THRESHOLD); QIMPenCharMatchList::Iterator it; for ( it = matches.begin(); it != matches.end(); ++it ) { if ( (*it).penChar->character() == tmplChar->character() && (*it).penChar->penStrokes().count() == tmplChar->penStrokes().count() ) { if ( (*it).error > err ) diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp index 3f4841d..564b6ba 100644 --- a/inputmethods/handwriting/qimpensetup.cpp +++ b/inputmethods/handwriting/qimpensetup.cpp @@ -1,159 +1,160 @@ /********************************************************************** ** 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 "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> +#include <opie2/odebug.h> /* XPM */ static const char * const left_xpm[] = { "16 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " .. ", " ... ", " .... ", " ..... ", " ...... ", " ..... ", " .... ", " ... ", " .. ", " . ", " ", " "}; /* XPM */ static const char * const right_xpm[] = { "16 16 2 1", " c None", ". c #000000", " ", " ", " ", " . ", " .. ", " ... ", " .... ", " ..... ", " ...... ", " ..... ", " .... ", " ... ", " .. ", " . ", " ", " "}; QIMPenSetup::QIMPenSetup( QIMPenProfile *p, QWidget *parent, const char *name, bool modal, int WFlags ) : QDialog( parent, name, modal, WFlags ), profileCombo(0), profile(p) { setCaption( tr("Setup Handwriting Input") ); QVBoxLayout *vb = new QVBoxLayout( this ); #define MULTIPROFILE #ifdef MULTIPROFILE profileList.setAutoDelete( true ); QHBoxLayout *hb = new QHBoxLayout( vb ); hb->setMargin( 6 ); QLabel *l = new QLabel( tr("Character Profile:"), this ); hb->addWidget( l ); profileCombo = new QComboBox( this ); connect( profileCombo, SIGNAL(activated(const QString&)), this, SLOT(selectProfile(const QString&)) ); hb->addWidget( profileCombo ); #else profileList.append( profile ); #endif - qWarning("profiles: %d", profileList.count()); + owarn << "profiles: " << profileList.count() << oendl; QTabWidget *tw = new QTabWidget( this ); vb->addWidget( tw ); pref = new QIMPenPrefBase( this ); tw->addTab( pref, tr("Preferences") ); pref->inputStyle->setExclusive( TRUE ); style = profile->style() == QIMPenProfile::ToggleCases ? 1 : 0; pref->inputStyle->setButton( style ); connect( pref->inputStyle, SIGNAL(clicked(int)), this, SLOT(styleClicked(int)) ); pref->inputStyle->setEnabled( profile->canSelectStyle() ); multiTimeout = profile->multiStrokeTimeout(); pref->multiStrokeSlider->setValue( multiTimeout ); multiTimeoutChanged( multiTimeout ); connect( pref->multiStrokeSlider, SIGNAL(valueChanged(int)), this, SLOT(multiTimeoutChanged(int)) ); edit = new QIMPenEdit( p, tw ); tw->addTab( edit, tr("Customize") ); #ifdef MULTIPROFILE loadProfiles(); #endif } void QIMPenSetup::loadProfiles() { 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 ); profileCombo->insertItem( p->name() ); if ( p->name() == profile->name() ) { profileCombo->setCurrentItem( profileCombo->count()-1 ); profile = p; edit->setProfile( profile ); } } } void QIMPenSetup::styleClicked( int id ) |