aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-08-30 22:17:36 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-09-08 17:11:23 +0000
commitf430cffbe94f0bf906b241bbca3fd3f91b3dba86 (patch)
tree771c1c95607a87c9321557a51f485f47232b2b8c /src
parentc8c4f832ec5853949604d1055a5b32394d23184c (diff)
3rdparty/t9write: Remove unused code
t9writeworker.cpp contained old unused code for result processing. Remove it. The instant gesture detection is useless in worker thread, since it is meant to be used in main thread for a specific use case in SCR mode. We don't need it, so remove it. Finally, the abort functionality of the recognition call was tested by calling the recognize function with interrupt function. This will not work in v8.0.0 anymore, where the recognize function will return error for all subsequent calls, even by setting the interrupt function to NULL. Instead, we now use a proper compile-time functional check. Change-Id: Ic98fd3b45912f29a4c72e3650f98b7b520c4ade9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/virtualkeyboard/3rdparty/t9write/unpack.py1
-rw-r--r--src/virtualkeyboard/t9write.h1
-rw-r--r--src/virtualkeyboard/t9writeworker.cpp46
3 files changed, 12 insertions, 36 deletions
diff --git a/src/virtualkeyboard/3rdparty/t9write/unpack.py b/src/virtualkeyboard/3rdparty/t9write/unpack.py
index e6a3e7a1..d3a67923 100644
--- a/src/virtualkeyboard/3rdparty/t9write/unpack.py
+++ b/src/virtualkeyboard/3rdparty/t9write/unpack.py
@@ -87,6 +87,7 @@ UNPACK_RULES = [
'*/decumaFunctionalSupportCheck.h',
'*/decumaLanguages.h',
'*/decumaLiteFunctionalSupport.h',
+ '*/decumaPlusFunctionalSupport.h',
'*/decumaRuntimeMallocData.h',
'*/decumaStatus.h',
'*/decumaStorageSpecifiers.h',
diff --git a/src/virtualkeyboard/t9write.h b/src/virtualkeyboard/t9write.h
index 621d2312..beebbaa2 100644
--- a/src/virtualkeyboard/t9write.h
+++ b/src/virtualkeyboard/t9write.h
@@ -37,6 +37,7 @@
#ifdef HAVE_T9WRITE_CJK
#include "decuma_hwr_cjk.h"
#endif
+#include "decumaFunctionalSupport.h"
#if defined(HAVE_T9WRITE_CJK) && defined(HAVE_T9WRITE_ALPHABETIC)
#define DECUMA_API(FUNC_NAME) (cjk ? decumaCJK ## FUNC_NAME : decuma ## FUNC_NAME)
diff --git a/src/virtualkeyboard/t9writeworker.cpp b/src/virtualkeyboard/t9writeworker.cpp
index adbdcedb..45608f77 100644
--- a/src/virtualkeyboard/t9writeworker.cpp
+++ b/src/virtualkeyboard/t9writeworker.cpp
@@ -167,40 +167,15 @@ void T9WriteRecognitionTask::run()
perf.start();
#endif
- DECUMA_STATUS status;
- if (!cjk) {
- status = DECUMA_API(IndicateInstantGesture)(decumaSession, &result->instantGesture, &instantGestureSettings);
- Q_ASSERT(status == decumaNoError);
- }
-
+#if SUPPORTS_ABORTRECOGNITION
DECUMA_INTERRUPT_FUNCTIONS interruptFunctions;
interruptFunctions.pShouldAbortRecognize = shouldAbortRecognize;
interruptFunctions.pUserData = (void *)this;
- result->status = DECUMA_API(Recognize)(decumaSession, result->results.data(), result->results.size(), &result->numResults, result->maxCharsPerWord, &recSettings, &interruptFunctions);
- if (result->status == decumaAbortRecognitionUnsupported)
- result->status = DECUMA_API(Recognize)(decumaSession, result->results.data(), result->results.size(), &result->numResults, result->maxCharsPerWord, &recSettings, NULL);
-
- QStringList resultList;
- QString gesture;
- for (int i = 0; i < result->numResults; i++)
- {
- QString resultString;
- resultString.reserve(result->results[i].nChars);
- int charPos = 0;
- for (int symbolIndex = 0; symbolIndex < result->results[i].nSymbols; symbolIndex++) {
- int symbolLength = result->results[i].pSymbolChars[symbolIndex];
- QString symbol(QString::fromUtf16(&result->results[i].pChars[charPos], symbolLength));
- // Do not append gesture symbol to result string
- if (result->results[i].bGesture && symbolIndex == (result->results[i].nSymbols - 1)) {
- if (i == 0 && (result->instantGesture || (symbol != QLatin1String(" ") && symbol != QLatin1String("\b"))))
- gesture = symbol;
- } else {
- resultString.append(symbol);
- }
- charPos += symbolLength;
- }
- resultList.append(resultString);
- }
+ DECUMA_INTERRUPT_FUNCTIONS *pInterruptFunctions = &interruptFunctions;
+#else
+ DECUMA_INTERRUPT_FUNCTIONS *pInterruptFunctions = NULL;
+#endif
+ result->status = DECUMA_API(Recognize)(decumaSession, result->results.data(), result->results.size(), &result->numResults, result->maxCharsPerWord, &recSettings, pInterruptFunctions);
#ifdef QT_VIRTUALKEYBOARD_DEBUG
int perfElapsed = perf.elapsed();
@@ -273,12 +248,11 @@ void T9WriteRecognitionResultsTask::run()
int symbolLength = hwrResult.pSymbolChars[symbolIndex];
QString symbol(QString::fromUtf16(&hwrResult.pChars[charPos], symbolLength));
// Do not append gesture symbol to result string
- if (hwrResult.bGesture && symbolIndex == (hwrResult.nSymbols - 1)) {
- if (result->instantGesture || (symbol != QLatin1String(" ") && symbol != QLatin1String("\b")))
- gesture = symbol;
- } else {
- resultString.append(symbol);
+ if (hwrResult.bGesture) {
+ gesture = symbol.right(1);
+ symbol.chop(1);
}
+ resultString.append(symbol);
charPos += symbolLength;
if (hwrResult.pSymbolStrokes)
symbolStrokes.append(QVariant((int)hwrResult.pSymbolStrokes[symbolIndex]));