Diffstat (limited to 'inputmethods/handwriting/qimpenmatch.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/handwriting/qimpenmatch.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
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 | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <opie2/odebug.h> | ||
28 | 29 | ||
29 | #include <limits.h> | 30 | #include <limits.h> |
30 | 31 | ||
@@ -68,7 +69,7 @@ void QIMPenMatch::beginStroke() | |||
68 | void QIMPenMatch::strokeEntered( QIMPenStroke *st ) | 69 | void QIMPenMatch::strokeEntered( QIMPenStroke *st ) |
69 | { | 70 | { |
70 | #ifdef DEBUG_QIMPEN | 71 | #ifdef DEBUG_QIMPEN |
71 | qDebug( "---------- new stroke -------------" ); | 72 | odebug << "---------- new stroke -------------" << oendl; |
72 | #endif | 73 | #endif |
73 | strokes.append( new QIMPenStroke( *st ) ); | 74 | strokes.append( new QIMPenStroke( *st ) ); |
74 | 75 | ||
@@ -81,12 +82,12 @@ void QIMPenMatch::strokeEntered( QIMPenStroke *st ) | |||
81 | QIMPenCharMatchList ml; | 82 | QIMPenCharMatchList ml; |
82 | if ( strokes.count() > 1 && multiCharSet ) { | 83 | if ( strokes.count() > 1 && multiCharSet ) { |
83 | #ifdef DEBUG_QIMPEN | 84 | #ifdef DEBUG_QIMPEN |
84 | qDebug( "Matching against multi set" ); | 85 | odebug << "Matching against multi set" << oendl; |
85 | #endif | 86 | #endif |
86 | ml = multiCharSet->match( &testChar ); | 87 | ml = multiCharSet->match( &testChar ); |
87 | } else { | 88 | } else { |
88 | #ifdef DEBUG_QIMPEN | 89 | #ifdef DEBUG_QIMPEN |
89 | qDebug( "Matching against single set" ); | 90 | odebug << "Matching against single set" << oendl; |
90 | #endif | 91 | #endif |
91 | ml = charSet->match( &testChar ); | 92 | ml = charSet->match( &testChar ); |
92 | } | 93 | } |
@@ -97,7 +98,7 @@ void QIMPenMatch::strokeEntered( QIMPenStroke *st ) | |||
97 | void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | 98 | void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) |
98 | { | 99 | { |
99 | #ifdef DEBUG_QIMPEN | 100 | #ifdef DEBUG_QIMPEN |
100 | qDebug( "Entering strokes.count() = %d", strokes.count() ); | 101 | odebug << "Entering strokes.count() = " << strokes.count() << oendl; |
101 | #endif | 102 | #endif |
102 | QIMPenCharMatch candidate1 = { INT_MAX, 0 }; | 103 | QIMPenCharMatch candidate1 = { INT_MAX, 0 }; |
103 | QIMPenCharMatch candidate2 = { INT_MAX, 0 }; | 104 | QIMPenCharMatch candidate2 = { INT_MAX, 0 }; |
@@ -107,7 +108,7 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
107 | // ml.first().penChar->penStrokes().count() == strokes.count() ) { | 108 | // ml.first().penChar->penStrokes().count() == strokes.count() ) { |
108 | candidate1 = ml.first(); | 109 | candidate1 = ml.first(); |
109 | #ifdef DEBUG_QIMPEN | 110 | #ifdef DEBUG_QIMPEN |
110 | qDebug( QString("Candidate1 = %1").arg(QChar(candidate1.penChar->character())) ); | 111 | odebug << "Candidate1 = " << candidate1.penChar->character() << oendl; |
111 | #endif | 112 | #endif |
112 | } | 113 | } |
113 | 114 | ||
@@ -120,7 +121,7 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
120 | if ( ml2.count() ) { | 121 | if ( ml2.count() ) { |
121 | candidate2 = ml2.first(); | 122 | candidate2 = ml2.first(); |
122 | #ifdef DEBUG_QIMPEN | 123 | #ifdef DEBUG_QIMPEN |
123 | qDebug( QString("Candidate2 = %1").arg(QChar(candidate2.penChar->character())) ); | 124 | odebug << "Candidate2 = " << candidate2.penChar->character() << oendl; |
124 | #endif | 125 | #endif |
125 | } | 126 | } |
126 | } | 127 | } |
@@ -142,7 +143,7 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
142 | multiCharSet = charSet; | 143 | multiCharSet = charSet; |
143 | ml = ml2; | 144 | ml = ml2; |
144 | #ifdef DEBUG_QIMPEN | 145 | #ifdef DEBUG_QIMPEN |
145 | qDebug( "** Using Candidate2" ); | 146 | odebug << "** Using Candidate2" << oendl; |
146 | #endif | 147 | #endif |
147 | } else { | 148 | } else { |
148 | if ( (prevMatchChar->character() >> 16) != Qt::Key_Backspace && | 149 | if ( (prevMatchChar->character() >> 16) != Qt::Key_Backspace && |
@@ -151,7 +152,7 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
151 | prevMatchChar = candidate1.penChar; | 152 | prevMatchChar = candidate1.penChar; |
152 | prevMatchError = candidate1.error; | 153 | prevMatchError = candidate1.error; |
153 | #ifdef DEBUG_QIMPEN | 154 | #ifdef DEBUG_QIMPEN |
154 | qDebug( "** Using Candidate1, with erase" ); | 155 | odebug << "** Using Candidate1, with erase" << oendl; |
155 | #endif | 156 | #endif |
156 | } | 157 | } |
157 | } else if ( candidate1.penChar ) { | 158 | } else if ( candidate1.penChar ) { |
@@ -162,7 +163,7 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
162 | prevMatchChar = candidate1.penChar; | 163 | prevMatchChar = candidate1.penChar; |
163 | prevMatchError = candidate1.error; | 164 | prevMatchError = candidate1.error; |
164 | #ifdef DEBUG_QIMPEN | 165 | #ifdef DEBUG_QIMPEN |
165 | qDebug( "** Using Candidate1" ); | 166 | odebug << "** Using Candidate1" << oendl; |
166 | #endif | 167 | #endif |
167 | } else if ( candidate2.penChar ) { | 168 | } else if ( candidate2.penChar ) { |
168 | int i = strokes.count()-1; | 169 | int i = strokes.count()-1; |
@@ -175,17 +176,17 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
175 | multiCharSet = charSet; | 176 | multiCharSet = charSet; |
176 | ml = ml2; | 177 | ml = ml2; |
177 | #ifdef DEBUG_QIMPEN | 178 | #ifdef DEBUG_QIMPEN |
178 | qDebug( "** Using Candidate2" ); | 179 | odebug << "** Using Candidate2" << oendl; |
179 | #endif | 180 | #endif |
180 | } else { | 181 | } else { |
181 | if ( !ml.count() ) { | 182 | if ( !ml.count() ) { |
182 | #ifdef DEBUG_QIMPEN | 183 | #ifdef DEBUG_QIMPEN |
183 | qDebug( "** Failed" ); | 184 | odebug << "** Failed" << oendl; |
184 | #endif | 185 | #endif |
185 | canErase = FALSE; | 186 | canErase = FALSE; |
186 | } else { | 187 | } else { |
187 | #ifdef DEBUG_QIMPEN | 188 | #ifdef DEBUG_QIMPEN |
188 | qDebug( "Need more strokes" ); | 189 | odebug << "Need more strokes" << oendl; |
189 | #endif | 190 | #endif |
190 | if ( strokes.count() == 1 ) | 191 | if ( strokes.count() == 1 ) |
191 | canErase = FALSE; | 192 | canErase = FALSE; |
@@ -197,7 +198,7 @@ void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) | |||
197 | 198 | ||
198 | if ( eraseLast && canErase ) { | 199 | if ( eraseLast && canErase ) { |
199 | #ifdef DEBUG_QIMPEN | 200 | #ifdef DEBUG_QIMPEN |
200 | qDebug( "deleting last" ); | 201 | odebug << "deleting last" << oendl; |
201 | #endif | 202 | #endif |
202 | emit erase(); | 203 | emit erase(); |
203 | wordChars.removeLast(); | 204 | wordChars.removeLast(); |
@@ -228,12 +229,12 @@ void QIMPenMatch::updateWordMatch( QIMPenCharMatchList &ml ) | |||
228 | if ( qch.isPunct() || qch.isSpace() || | 229 | if ( qch.isPunct() || qch.isSpace() || |
229 | code == Qt::Key_Enter || code == Qt::Key_Return || | 230 | code == Qt::Key_Enter || code == Qt::Key_Return || |
230 | code == Qt::Key_Tab || code == Qt::Key_Escape ) { | 231 | code == Qt::Key_Tab || code == Qt::Key_Escape ) { |
231 | //qDebug( "Word Matching: Clearing word" ); | 232 | //odebug << "Word Matching: Clearing word" << oendl; |
232 | wordChars.clear(); | 233 | wordChars.clear(); |
233 | wordMatches.clear(); | 234 | wordMatches.clear(); |
234 | wordEntered = QString(); | 235 | wordEntered = QString(); |
235 | } else if ( code == Qt::Key_Backspace ) { | 236 | } else if ( code == Qt::Key_Backspace ) { |
236 | //qDebug( "Word Matching: Handle backspace" ); | 237 | //odebug << "Word Matching: Handle backspace" << oendl; |
237 | wordChars.removeLast(); | 238 | wordChars.removeLast(); |
238 | wordEntered.truncate( wordEntered.length() - 1 ); | 239 | wordEntered.truncate( wordEntered.length() - 1 ); |
239 | matchWords(); | 240 | matchWords(); |
@@ -281,11 +282,11 @@ void QIMPenMatch::matchWords() | |||
281 | /* | 282 | /* |
282 | QListIterator<MatchWord> it( wordMatches); | 283 | QListIterator<MatchWord> it( wordMatches); |
283 | for ( ; it.current(); ++it ) { | 284 | for ( ; it.current(); ++it ) { |
284 | qDebug( QString("Match word: %1").arg(it.current()->word) ); | 285 | odebug << "Match word: " << it.current()->word << oendl; |
285 | } | 286 | } |
286 | */ | 287 | */ |
287 | } | 288 | } |
288 | //qDebug( "Possibles: Good %d, total %d", goodMatches, wordMatches.count() ); | 289 | //odebug << "Possibles: Good " << goodMatches << ", total " << wordMatches.count() << oendl; |
289 | wordMatches.sort(); | 290 | wordMatches.sort(); |
290 | } | 291 | } |
291 | 292 | ||