summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenchar.cpp9
-rw-r--r--inputmethods/handwriting/qimpeninput.cpp24
-rw-r--r--inputmethods/handwriting/qimpenmatch.cpp35
-rw-r--r--inputmethods/handwriting/qimpenstroke.cpp15
-rw-r--r--inputmethods/handwriting/qimpenwordpick.cpp2
5 files changed, 45 insertions, 40 deletions
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp
index 929f370..db5d135 100644
--- a/inputmethods/handwriting/qimpenchar.cpp
+++ b/inputmethods/handwriting/qimpenchar.cpp
@@ -25,8 +25,9 @@
#include <errno.h>
#include <qdatastream.h>
#include "qimpencombining.h"
#include "qimpenchar.h"
+#include "opie2/odebug.h"
#define QIMPEN_MATCH_THRESHOLD 200000
const QIMPenSpecialKeys qimpen_specialKeys[] = {
@@ -166,9 +167,9 @@ int QIMPenChar::match( QIMPenChar *pen )
if ( ydiff < 0 )
ydiff = 0;
if ( xdiff > 10 || ydiff > 10 ) { // not a chance
#ifdef DEBUG_QIMPEN
- qDebug( "char %c, stroke starting pt diff excessive", pen->ch );
+ odebug << "char " << pen->ch <<", stroke starting pt diff excessive" << oendl;
#endif
return INT_MAX;
}
diff += xdiff*xdiff + ydiff*ydiff;
@@ -181,9 +182,9 @@ int QIMPenChar::match( QIMPenChar *pen )
maxErr += diff * diff * 6; // magic weighting :)
#ifdef DEBUG_QIMPEN
- qDebug( "char: %c, maxErr %d, diff %d, (%d)", pen->ch, maxErr, diff, strokes.count() );
+ odebug << "char: " << pen->ch << ", maxErr " << maxErr << ", diff " << diff << ", " << strokes.count() << oendl;
#endif
return maxErr;
}
@@ -457,10 +458,10 @@ QIMPenCharMatchList QIMPenCharSet::match( QIMPenChar *ch )
qHeapSort( matches );
/*
QIMPenCharMatchList::Iterator it;
for ( it = matches.begin(); it != matches.end(); ++it ) {
- qDebug( "Match: \'%c\', error %d, strokes %d", (*it).penChar->character(),
- (*it).error, (*it).penChar->penStrokes().count() );
+
+ odebug << "Match: \'" << (*it).penChar->character() "\', error " << (*it).error ", strokes " <<(*it).penChar->penStrokes().count() << oendl;
}
*/
return matches;
}
diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp
index d073cdf..6ea1bb4 100644
--- a/inputmethods/handwriting/qimpeninput.cpp
+++ b/inputmethods/handwriting/qimpeninput.cpp
@@ -35,8 +35,9 @@
#include <qpushbutton.h>
#include <qlabel.h>
#include <qtimer.h>
#include <qdir.h>
+#include <opie2/odebug.h>
#include <limits.h>
// We'll use little pixmaps for the buttons to save screen space.
@@ -318,9 +319,9 @@ void QIMPenInput::wordPicked( const QString &w )
void QIMPenInput::selectCharSet( int idx )
{
if ( mode == Switch ) {
- //qDebug( "Switch back to normal" );
+ //odebug << "Switch back to normal" << oendl;
pw->changeCharSet( baseSets.at(currCharSet), currCharSet );
mode = Normal;
}
currCharSet = idx;
@@ -352,33 +353,34 @@ void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl )
switch ( scan ) {
case QIMPenChar::Caps:
if ( profile->style() == QIMPenProfile::ToggleCases ) {
-// qDebug( "Caps" );
+// odebug << "Caps" << oendl;
+//
if ( mode == SwitchLock ) {
-// qDebug( "Switch to normal" );
+// odebug << "Switch to normal" << oendl;
pw->changeCharSet( profile->lowercase(), currCharSet );
mode = Switch;
} else {
-// qDebug( "Switch to upper" );
+// odebug << "Switch to upper" << oendl;
pw->changeCharSet( profile->uppercase(), currCharSet );
mode = Switch;
}
}
break;
case QIMPenChar::CapsLock:
if ( profile->style() == QIMPenProfile::ToggleCases ) {
-// qDebug( "CapsLock" );
+// odebug << "CapsLock" << oendl;
if ( mode == Switch &&
baseSets.at(currCharSet) == profile->uppercase() ) {
-// qDebug( "Switch to normal" );
+// odebug << "Switch to normal" << oendl;
pw->changeCharSet( profile->lowercase(), currCharSet );
// change our base set back to lower.
baseSets.remove( currCharSet );
baseSets.insert( currCharSet, profile->lowercase() );
mode = Normal;
} else {
-// qDebug( "Switch to caps lock" );
+// odebug << "Switch to caps lock" << oendl;
pw->changeCharSet( profile->uppercase(), currCharSet );
// change our base set to upper.
baseSets.remove( currCharSet );
baseSets.insert( currCharSet, profile->uppercase() );
@@ -387,16 +389,16 @@ void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl )
}
break;
case QIMPenChar::Punctuation:
if ( profile->punctuation() ) {
- //qDebug( "Switch to punctuation" );
+ //odebug << "Switch to punctuation" << oendl;
pw->changeCharSet( profile->punctuation(), currCharSet );
mode = Switch;
}
break;
case QIMPenChar::Symbol:
if ( profile->symbol() ) {
- //qDebug( "Switch to symbol" );
+ //odebug << "Switch to symbol" << oendl ;
pw->changeCharSet( profile->symbol(), currCharSet );
mode = Switch;
}
break;
@@ -442,9 +444,9 @@ void QIMPenInput::keypress( uint scan_uni )
break;
}
if ( mode == Switch ) {
-// qDebug( "Switch back to normal" );
+// odebug << "Switch back to normal" << oendl ;
pw->changeCharSet( baseSets.at(currCharSet), currCharSet );
if ( baseSets.at(currCharSet) == profile->uppercase() )
mode = SwitchLock;
else
@@ -458,9 +460,9 @@ void QIMPenInput::keypress( uint scan_uni )
void QIMPenInput::handleExtended( const QString &ex )
{
if ( ex.find( "Select" ) == 0 ) {
QString set = ex.mid( 7 );
- qDebug( "Select new profile: %s", set.latin1() );
+ odebug << "Select new profile: " << set.latin1() << oendl;
selectProfile( set );
}
}
diff --git a/inputmethods/handwriting/qimpenmatch.cpp b/inputmethods/handwriting/qimpenmatch.cpp
index 0d3e25a..a0448b6 100644
--- a/inputmethods/handwriting/qimpenmatch.cpp
+++ b/inputmethods/handwriting/qimpenmatch.cpp
@@ -24,8 +24,9 @@
#include <qpe/global.h>
#include <qapplication.h>
#include <qtimer.h>
+#include <opie2/odebug.h>
#include <limits.h>
#define ERROR_THRESHOLD 200000
@@ -67,9 +68,9 @@ void QIMPenMatch::beginStroke()
void QIMPenMatch::strokeEntered( QIMPenStroke *st )
{
#ifdef DEBUG_QIMPEN
- qDebug( "---------- new stroke -------------" );
+ odebug << "---------- new stroke -------------" << oendl;
#endif
strokes.append( new QIMPenStroke( *st ) );
QIMPenChar testChar;
@@ -80,14 +81,14 @@ void QIMPenMatch::strokeEntered( QIMPenStroke *st )
QIMPenCharMatchList ml;
if ( strokes.count() > 1 && multiCharSet ) {
#ifdef DEBUG_QIMPEN
- qDebug( "Matching against multi set" );
+ odebug << "Matching against multi set" << oendl;
#endif
ml = multiCharSet->match( &testChar );
} else {
#ifdef DEBUG_QIMPEN
- qDebug( "Matching against single set" );
+ odebug << "Matching against single set" << oendl;
#endif
ml = charSet->match( &testChar );
}
@@ -96,9 +97,9 @@ void QIMPenMatch::strokeEntered( QIMPenStroke *st )
void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
{
#ifdef DEBUG_QIMPEN
- qDebug( "Entering strokes.count() = %d", strokes.count() );
+ odebug << "Entering strokes.count() = " << strokes.count() << oendl;
#endif
QIMPenCharMatch candidate1 = { INT_MAX, 0 };
QIMPenCharMatch candidate2 = { INT_MAX, 0 };
QIMPenCharMatchList ml2;
@@ -106,9 +107,9 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
if ( ml.count() ) {//&&
// ml.first().penChar->penStrokes().count() == strokes.count() ) {
candidate1 = ml.first();
#ifdef DEBUG_QIMPEN
- qDebug( QString("Candidate1 = %1").arg(QChar(candidate1.penChar->character())) );
+ odebug << "Candidate1 = " << candidate1.penChar->character() << oendl;
#endif
}
if ( strokes.count() > 1 ) {
@@ -119,9 +120,9 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
ml2 = charSet->match( &testChar );
if ( ml2.count() ) {
candidate2 = ml2.first();
#ifdef DEBUG_QIMPEN
- qDebug( QString("Candidate2 = %1").arg(QChar(candidate2.penChar->character())) );
+ odebug << "Candidate2 = " << candidate2.penChar->character() << oendl;
#endif
}
}
@@ -141,18 +142,18 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
prevMatchError = candidate2.error;
multiCharSet = charSet;
ml = ml2;
#ifdef DEBUG_QIMPEN
- qDebug( "** Using Candidate2" );
+ odebug << "** Using Candidate2" << oendl;
#endif
} else {
if ( (prevMatchChar->character() >> 16) != Qt::Key_Backspace &&
(prevMatchChar->character() >> 16) < QIMPenChar::ModeBase )
eraseLast = TRUE;
prevMatchChar = candidate1.penChar;
prevMatchError = candidate1.error;
#ifdef DEBUG_QIMPEN
- qDebug( "** Using Candidate1, with erase" );
+ odebug << "** Using Candidate1, with erase" << oendl;
#endif
}
} else if ( candidate1.penChar ) {
if ( strokes.count() != 1 )
@@ -161,9 +162,9 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
multiCharSet = charSet;
prevMatchChar = candidate1.penChar;
prevMatchError = candidate1.error;
#ifdef DEBUG_QIMPEN
- qDebug( "** Using Candidate1" );
+ odebug << "** Using Candidate1" << oendl;
#endif
} else if ( candidate2.penChar ) {
int i = strokes.count()-1;
while ( i-- ) {
@@ -174,19 +175,19 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
prevMatchError = candidate2.error;
multiCharSet = charSet;
ml = ml2;
#ifdef DEBUG_QIMPEN
- qDebug( "** Using Candidate2" );
+ odebug << "** Using Candidate2" << oendl;
#endif
} else {
if ( !ml.count() ) {
#ifdef DEBUG_QIMPEN
- qDebug( "** Failed" );
+ odebug << "** Failed" << oendl;
#endif
canErase = FALSE;
} else {
#ifdef DEBUG_QIMPEN
- qDebug( "Need more strokes" );
+ odebug << "Need more strokes" << oendl;
#endif
if ( strokes.count() == 1 )
canErase = FALSE;
multiCharSet = charSet;
@@ -196,9 +197,9 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml )
}
if ( eraseLast && canErase ) {
#ifdef DEBUG_QIMPEN
- qDebug( "deleting last" );
+ odebug << "deleting last" << oendl;
#endif
emit erase();
wordChars.removeLast();
wordEntered.truncate( wordEntered.length() - 1 );
@@ -227,14 +228,14 @@ void QIMPenMatch::updateWordMatch( QIMPenCharMatchList &ml )
int code = ch >> 16;
if ( qch.isPunct() || qch.isSpace() ||
code == Qt::Key_Enter || code == Qt::Key_Return ||
code == Qt::Key_Tab || code == Qt::Key_Escape ) {
-// qDebug( "Word Matching: Clearing word" );
+// odebug << "Word Matching: Clearing word" << oendl;
wordChars.clear();
wordMatches.clear();
wordEntered = QString();
} else if ( code == Qt::Key_Backspace ) {
- //qDebug( "Word Matching: Handle backspace" );
+ //odebug << "Word Matching: Handle backspace" << oendl;
wordChars.removeLast();
wordEntered.truncate( wordEntered.length() - 1 );
matchWords();
} else {
@@ -280,13 +281,13 @@ void QIMPenMatch::matchWords()
scanDict( Global::fixedDawg().root(), 0, str, 0 );
/*
QListIterator<MatchWord> it( wordMatches);
for ( ; it.current(); ++it ) {
- qDebug( QString("Match word: %1").arg(it.current()->word) );
+ odebug << "Match word: " << it.current()->word << oendl;
}
*/
}
- //qDebug( "Possibles: Good %d, total %d", goodMatches, wordMatches.count() );
+ //odebug << "Possibles: Good " << goodMatches << ", total " << wordMatches.count() << oendl;
wordMatches.sort();
}
void QIMPenMatch::scanDict( const QDawg::Node* n, int ipos, const QString& str, int error )
diff --git a/inputmethods/handwriting/qimpenstroke.cpp b/inputmethods/handwriting/qimpenstroke.cpp
index 3567d6d..14e435a 100644
--- a/inputmethods/handwriting/qimpenstroke.cpp
+++ b/inputmethods/handwriting/qimpenstroke.cpp
@@ -23,8 +23,9 @@
#include <math.h>
#include <limits.h>
#include <qdatastream.h>
#include "qimpenstroke.h"
+#include "opie2/odebug.h"
#define QIMPEN_CORRELATION_POINTS 25
//#define DEBUG_QIMPEN
@@ -48,9 +49,9 @@ QIMPenStroke::QIMPenStroke( const QIMPenStroke &st )
QIMPenStroke &QIMPenStroke::operator=( const QIMPenStroke &s )
{
clear();
- //qDebug( "copy strokes %d", s.links.count() );
+ //odebug << "copy strokes " << s.links.count() << oendl;
startPoint = s.startPoint;
lastPoint = s.lastPoint;
links = s.links.copy();
@@ -148,9 +149,9 @@ void QIMPenStroke::endInput()
gl.dy = 0;
links[0] = gl;
}
- //qDebug("Points: %d", links.count() );
+ //odebug << "Points: " << links.count() << oendl;
}
/*!
Return an indicator of the closeness of this stroke to \a pen.
@@ -168,9 +169,9 @@ unsigned int QIMPenStroke::match( QIMPenStroke *pen )
lratio -= 1.0;
if ( lratio > 2.0 ) {
#ifdef DEBUG_QIMPEN
- qDebug( "stroke length too different" );
+ odebug << "stroke length too different" << oendl;
#endif
return 400000;
}
@@ -214,26 +215,26 @@ unsigned int QIMPenStroke::match( QIMPenStroke *pen )
err1 = e;
}
if ( err1 > 40 ) { // no need for more matching
#ifdef DEBUG_QIMPEN
- qDebug( "tsig too great: %d", err1 );
+ odebug << "tsig too great: " << err1 << oendl;
#endif
return 400000;
}
// maybe a sliding window is worthwhile for these too.
err2 = calcError( dsig, pen->dsig, 0, FALSE );
if ( err2 > 100 ) {
#ifdef DEBUG_QIMPEN
- qDebug( "dsig too great: %d", err2 );
+ odebug << "dsig too great: " << err2 << oendl;
#endif
return 400000;
}
err3 = calcError( asig, pen->asig, 0, TRUE );
if ( err3 > 60 ) {
#ifdef DEBUG_QIMPEN
- qDebug( "asig too great: %d", err3 );
+ odebug << "asig too great: " << err3 << oendl;
#endif
return 400000;
}
@@ -246,9 +247,9 @@ unsigned int QIMPenStroke::match( QIMPenStroke *pen )
vdiff * 1000 + evdiff * 500 +
(unsigned int)(lratio * 5000.0);
#ifdef DEBUG_QIMPEN
- qDebug( "err %d ( %d, %d, %d, %d)", err, err1, err2, err3, vdiff );
+ odebug << "err " << err << "( " << err1 << ", " << err2 << ", " << err3 << ", " << vdiff << oendl;
#endif
return err;
}
diff --git a/inputmethods/handwriting/qimpenwordpick.cpp b/inputmethods/handwriting/qimpenwordpick.cpp
index 8ee103d..39745c6 100644
--- a/inputmethods/handwriting/qimpenwordpick.cpp
+++ b/inputmethods/handwriting/qimpenwordpick.cpp
@@ -103,9 +103,9 @@ void QIMPenWordPick::mousePressEvent( QMouseEvent *e )
void QIMPenWordPick::mouseReleaseEvent( QMouseEvent *e )
{
int wordIdx = onWord( e->pos() );
if ( wordIdx >= 0 && wordIdx == clickWord ) {
- //qDebug( "Clicked %s", words[wordIdx].latin1() );
+ //odebug << "Clicked " << words[wordIdx].latin1() << oendl;
emit wordClicked( words[wordIdx] );
}
clickWord = -1;
repaint();